-
-
Notifications
You must be signed in to change notification settings - Fork 3
44 lines (37 loc) · 1.28 KB
/
update-changesets.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
name: update-changesets
env:
WORKFLOW_FILE: update-changesets.yml
on:
issue_comment:
types:
- created
jobs:
build:
if: startsWith(github.event.comment.body, '/update-changesets') && github.event.issue.locked
name: 🛠️ Update changesets
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
steps:
- name: 🚚 Checkout (gh_pages)
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: gh_pages
- name: 🔍 Check other workflows
run: |
# Get in-progress or queued workflows.
gh auth login --with-token < <(echo ${{ github.token }})
RESULT=`gh run list --workflow ${{ env.WORKFLOW_FILE }} --json status --jq '[.[] | select(.status == "in_progress")] | length == 1'`
# [ERROR] Other workflows are in progress.
[ "$RESULT" = "false" ] && echo "::error::Other '${{ env.WORKFLOW_FILE }}' workflows are in progress." && exit 1 || :
- name: 🛠️ Update changesets file
run: npx unity-changeset list --all --all-lifecycles > db
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ github.token }}
amend: true
force: true
branch: gh_pages