-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (55 loc) · 1.67 KB
/
commit-recent-twilogs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Commit Recent Twilogs
on:
workflow_dispatch:
schedule:
# Run every 4 hours
- cron: "23 */4 * * *"
permissions:
contents: write
id-token: write
concurrency:
group: commit-recent-twilogs
cancel-in-progress: false
jobs:
commit-recent-twilogs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
key: v1-${{ hashFiles('package-lock.json') }}-
restore-keys: |
v1-
path: |
node_modules
- uses: actions/setup-node@v3
with:
node-version: "16"
- run: npm ci
- name: Setup git
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Fetch, commit and push if anything new
id: fetch
run: |
if npm run fetch_recent_twilogs; then
git diff --name-only HEAD~ | grep "\-twilogs.json" | xargs npm run build_twilog_meilisearch_index
git push origin HEAD:master
echo "has_new_twilogs=true" >> "$GITHUB_OUTPUT"
fi
env:
MY_TWILOG_CSV_URL: ${{ secrets.MY_TWILOG_CSV_URL }}
MEILISEARCH_HOST: ${{ secrets.MEILISEARCH_HOST }}
MEILISEARCH_ADMIN_KEY: ${{ secrets.MEILISEARCH_ADMIN_KEY }}
outputs:
has_new_twilogs: ${{ steps.fetch.outputs.has_new_twilogs }}
deploy:
needs: commit-recent-twilogs
if: needs.commit-recent-twilogs.outputs.has_new_twilogs
uses: ./.github/workflows/gh-pages.yml
secrets: inherit
permissions:
contents: read
pages: write
id-token: write