@@ -15,64 +15,20 @@ defaults:
1515jobs :
1616 update-reference-screenshots :
1717 name : Update Galata References
18- if : >
19- (
20- github.event.comment.author_association == 'OWNER' ||
21- github.event.comment.author_association == 'COLLABORATOR' ||
22- github.event.comment.author_association == 'MEMBER'
23- ) && github.event.issue.pull_request && contains(github.event.comment.body, 'please update snapshots')
18+ if : github.event.issue.pull_request && (
19+ contains(github.event.comment.body, 'please update galata snapshots') ||
20+ contains(github.event.comment.body, 'please update snapshots')
21+ )
2422 runs-on : ubuntu-latest
2523 strategy :
2624 matrix :
2725 python-version : [3.10]
2826 node-version : [18.x]
2927
3028 steps :
31- - name : React to the triggering comment
32- run : |
33- gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --raw-field 'content=+1'
34- env :
35- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36-
37- - name : Checkout
38- uses : actions/checkout@v4
29+ - uses : jupyterlab/maintainer-tools/.github/actions/update-snapshots-checkout@main
3930 with :
40- token : ${{ secrets.GITHUB_TOKEN }}
41-
42- - name : Get PR Info
43- id : pr
44- env :
45- PR_NUMBER : ${{ github.event.issue.number }}
46- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
47- GH_REPO : ${{ github.repository }}
48- COMMENT_AT : ${{ github.event.comment.created_at }}
49- run : |
50- pr="$(gh api /repos/${GH_REPO}/pulls/${PR_NUMBER})"
51- head_sha="$(echo "$pr" | jq -r .head.sha)"
52- pushed_at="$(echo "$pr" | jq -r .pushed_at)"
53-
54- if [[ $(date -d "$pushed_at" +%s) -gt $(date -d "$COMMENT_AT" +%s) ]]; then
55- echo "Updating is not allowed because the PR was pushed to (at $pushed_at) after the triggering comment was issued (at $COMMENT_AT)"
56- exit 1
57- fi
58-
59- echo "head_sha=$head_sha" >> $GITHUB_OUTPUT
60-
61- - name : Checkout the branch from the PR that triggered the job
62- env :
63- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
64- run : gh pr checkout ${{ github.event.issue.number }}
65-
66- - name : Validate the fetched branch HEAD revision
67- env :
68- EXPECTED_SHA : ${{ steps.pr.outputs.head_sha }}
69- run : |
70- actual_sha="$(git rev-parse HEAD)"
71-
72- if [[ "$actual_sha" != "$EXPECTED_SHA" ]]; then
73- echo "The HEAD of the checked out branch ($actual_sha) differs from the HEAD commit available at the time when trigger comment was submitted ($EXPECTED_SHA)"
74- exit 1
75- fi
31+ github_token : ${{ secrets.GITHUB_TOKEN }}
7632
7733 - name : Base Setup
7834 uses : jupyterlab/maintainer-tools/.github/actions/base-setup@v1
0 commit comments