-
Notifications
You must be signed in to change notification settings - Fork 15
51 lines (45 loc) · 1.54 KB
/
refresh-index-chains.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
name: Update chains and flex index files
on:
push:
branches:
- main
schedule:
# Run every day at 12:00
- cron: '0 12 * * *'
jobs:
conditional_PR_generation:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- run: pnpm install
- name: Refresh chains and flex index files
# If changes are present after build, set env variable
run: |
pnpm axios:build
pnpm docs:build
pnpm flex:build
pnpm flex:test
git diff --quiet --exit-code || echo "CHANGES_FOUND=true" >> $GITHUB_ENV
- name: Create PR if files have changed
if: env.CHANGES_FOUND == 'true'
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git fetch origin main
git checkout -B ${{ env.BRANCH_NAME }} origin/main
git commit -am "Update chains and flex index files"
git push -f origin ${{ env.BRANCH_NAME }}
gh pr create -B main -H ${{ env.BRANCH_NAME }} --title 'Update chains and flex index files' --body 'Created by GitHub Actions Cron Job' --reviewer wkande,dcroote
env:
BRANCH_NAME: "actions-chains-index-update"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}