Skip to content

Commit a2654c1

Browse files
committed
ci: fix update snapshot workflow
1 parent 5daf180 commit a2654c1

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

.github/workflows/update-snapshot.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
create-pr:
1616
needs: create-snapshot
1717
runs-on: ubuntu-24.04
18+
permissions:
19+
contents: write
1820
steps:
1921
- uses: actions/checkout@v5
2022
with:
@@ -28,19 +30,16 @@ jobs:
2830
name: snapshot
2931
path: test/snapshot
3032

31-
- name: Compare snapshots
32-
id: compare-snapshots
33+
- name: Configure git author
3334
run: |
34-
git add test/snapshot
35-
set +e
36-
git diff --staged --exit-code test/snapshot
37-
echo "diff=$?" >> "$GITHUB_OUTPUT"
35+
git config user.name 'github-actions'
36+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
3837
3938
- name: Create a pull request
40-
if: steps.compare-snapshots.outputs.diff != '0'
4139
run: |
42-
git config user.name 'github-actions'
43-
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
4440
git switch -c update-snapshots-${{ github.run_id }}
41+
git add test/snapshot
4542
git commit -m 'test: update snapshots'
4643
gh pr create --dry-run --fill --base "$GITHUB_REF_NAME"
44+
env:
45+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)