Skip to content

Commit

Permalink
Merge pull request #2221 from Urigo/chore/restore-algolia-workflows
Browse files Browse the repository at this point in the history
chore(ci): restore algolia workflows
  • Loading branch information
charlypoly committed Jun 27, 2022
2 parents fd2845c + 31543c5 commit 6892035
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/algolia-integrity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Algolia Integrity
on:
pull_request:
paths:
- 'website/**'
jobs:
algolia-records-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch
run: git fetch origin master
- name: Use Node 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install Dependencies
run: yarn --ignore-engines

- name: Build Packages
run: yarn build

- name: Algolia generate
run: yarn workspace website algolia-sync
env:
ALGOLIA_DRY_RUN: true
SITE_URL: https://www.graphql-modules.com/

- name: Format
run: yarn format

- name: Compare
run: git diff origin/${{ github.base_ref }}.. -- website/algolia-lockfile.json

- name: Diff to file
if: always()
id: diff_result
run: |
OUTPUT=$(git diff origin/${{ github.base_ref }}.. -- website/algolia-lockfile.json)
OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=result::$OUTPUT"
- name: Publish a message
if: always() && contains(steps.diff_result.outputs.result, 'diff')
uses: marocchino/sticky-pull-request-comment@v2
with:
message: |
```diff
${{ steps.diff_result.outputs.result }}
```
58 changes: 58 additions & 0 deletions .github/workflows/algolia-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Algolia Publish

on:
push:
branches:
- master

jobs:
algolia-push-records:
name: Push new records if changes
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'

- name: Install Dependencies
run: yarn

- name: Build Packages
run: yarn build

- name: Algolia push
run: yarn workspace website algolia-sync
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}
SITE_URL: https://www.graphql-modules.com/

- name: Format
run: yarn format

- name: Compare
run: git diff website/algolia-lockfile.json

- name: Diff to file
if: always()
id: diff_result
run: |
OUTPUT=$(git diff website/algolia-lockfile.json)
OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=result::$OUTPUT"
- name: Commit algolia-lockfile.json
if: always() && contains(steps.diff_result.outputs.result, 'diff')
uses: EndBug/add-and-commit@v9
with:
commit: website/algolia-lockfile.json
message: Update algolia-lockfile.json
default_author: github_actions

1 comment on commit 6892035

@vercel
Copy link

@vercel vercel bot commented on 6892035 Jun 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.