Skip to content

Commit b3498c2

Browse files
Fix update-sample-data workflow pushing to protected master branch (#14374)
The branch parameter used github.ref_name which resolved to 'master' when triggered via workflow_dispatch, causing a push to a protected branch. Simplify by letting create-pull-request manage the branch using a fixed name, removing the now-redundant manual branch steps.
1 parent e4df9d9 commit b3498c2

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

.github/workflows/update-sample-data.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,12 @@ jobs:
3030
git config --global user.name "${{ env.GIT_USERNAME }}"
3131
git config --global user.email "${{ env.GIT_EMAIL }}"
3232
33-
- name: Create and switch to a new branch
34-
run: |
35-
git checkout -b update-file-$(date +%Y%m%d%H%M%S)
36-
git add dojo/fixtures/defect_dojo_sample_data.json
37-
git commit -m "Update sample data"
38-
39-
- name: Push branch
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
run: |
43-
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
44-
4533
- name: Create Pull Request
4634
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
4735
with:
4836
token: ${{ secrets.GITHUB_TOKEN }}
4937
commit-message: "Update sample data"
50-
branch: ${{ github.ref_name || 'dev'}}
38+
branch: update-sample-data
5139
base: dev
5240
title: "Update sample data"
5341
body: "This pull request updates the sample data."

0 commit comments

Comments
 (0)