Skip to content

Commit 6892035

Browse files
authored
Merge pull request #2221 from Urigo/chore/restore-algolia-workflows
chore(ci): restore algolia workflows
2 parents fd2845c + 31543c5 commit 6892035

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Algolia Integrity
2+
on:
3+
pull_request:
4+
paths:
5+
- 'website/**'
6+
jobs:
7+
algolia-records-check:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
- name: Fetch
15+
run: git fetch origin master
16+
- name: Use Node 18
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
cache: 'yarn'
21+
- name: Install Dependencies
22+
run: yarn --ignore-engines
23+
24+
- name: Build Packages
25+
run: yarn build
26+
27+
- name: Algolia generate
28+
run: yarn workspace website algolia-sync
29+
env:
30+
ALGOLIA_DRY_RUN: true
31+
SITE_URL: https://www.graphql-modules.com/
32+
33+
- name: Format
34+
run: yarn format
35+
36+
- name: Compare
37+
run: git diff origin/${{ github.base_ref }}.. -- website/algolia-lockfile.json
38+
39+
- name: Diff to file
40+
if: always()
41+
id: diff_result
42+
run: |
43+
OUTPUT=$(git diff origin/${{ github.base_ref }}.. -- website/algolia-lockfile.json)
44+
OUTPUT="${OUTPUT//'%'/'%25'}"
45+
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
46+
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
47+
echo "::set-output name=result::$OUTPUT"
48+
49+
- name: Publish a message
50+
if: always() && contains(steps.diff_result.outputs.result, 'diff')
51+
uses: marocchino/sticky-pull-request-comment@v2
52+
with:
53+
message: |
54+
```diff
55+
${{ steps.diff_result.outputs.result }}
56+
```
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Algolia Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
algolia-push-records:
10+
name: Push new records if changes
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repo
14+
uses: actions/checkout@v3
15+
16+
- name: Use Node
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
cache: 'yarn'
21+
22+
- name: Install Dependencies
23+
run: yarn
24+
25+
- name: Build Packages
26+
run: yarn build
27+
28+
- name: Algolia push
29+
run: yarn workspace website algolia-sync
30+
env:
31+
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
32+
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
33+
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}
34+
SITE_URL: https://www.graphql-modules.com/
35+
36+
- name: Format
37+
run: yarn format
38+
39+
- name: Compare
40+
run: git diff website/algolia-lockfile.json
41+
42+
- name: Diff to file
43+
if: always()
44+
id: diff_result
45+
run: |
46+
OUTPUT=$(git diff website/algolia-lockfile.json)
47+
OUTPUT="${OUTPUT//'%'/'%25'}"
48+
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
49+
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
50+
echo "::set-output name=result::$OUTPUT"
51+
52+
- name: Commit algolia-lockfile.json
53+
if: always() && contains(steps.diff_result.outputs.result, 'diff')
54+
uses: EndBug/add-and-commit@v9
55+
with:
56+
commit: website/algolia-lockfile.json
57+
message: Update algolia-lockfile.json
58+
default_author: github_actions

0 commit comments

Comments
 (0)