-
Notifications
You must be signed in to change notification settings - Fork 152
71 lines (59 loc) · 2.19 KB
/
update-changeset-prs.yaml
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
60
61
62
63
64
65
66
67
68
69
70
71
name: Update changeset PRs
on:
push:
branches:
- 'changeset-release/**'
env:
TURBO_SCM_BASE: ${{ github.event.before }}
TURBO_SCM_HEAD: ${{ github.sha }}
# enforce only one release action per release branch at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prev-commit:
name: Verify previous commit
runs-on: ubuntu-latest
outputs:
valid: ${{ steps.prev-commit.outputs.valid }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
# We do not want an infinite loop; therefore, we are checking if the previous
# commit was created by this action.
- name: Get previous commit message
id: prev-commit
run: |
echo "valid=$(if [[ $(git log -1 --pretty=%B HEAD) != 'chore: update yarn.lock' ]]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT
update-and-commit-files:
name: Update and commit files
needs: prev-commit
if: needs.prev-commit.outputs.valid == 'true'
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4 # v1.10.3
with:
app-id: ${{ vars.JANUS_IDP_GITHUB_APP_ID }}
private-key: ${{ secrets.JANUS_IDP_GITHUB_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
# We want to commit the yarn.lock changes
run: yarn install
- name: Clean export dynamic
# We want a clean dynamic folder
run: yarn run export-dynamic:clean --concurrency=75% --affected
- name: Amend previous commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'chore: update yarn.lock'