Skip to content

Commit 6aa3116

Browse files
locus313Copilot
andcommitted
fix: open PR instead of pushing directly to protected main branch
The update-readme-sha workflow was pushing directly to main, which is blocked by branch protection (requires PR + Shellcheck status check). Now creates a branch and opens a PR via gh CLI instead. Also adds pull-requests: write permission. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c75ec45 commit 6aa3116

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/update-readme-sha.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
permissions:
1818
contents: write
19+
pull-requests: write
1920
steps:
2021
- name: Checkout code
2122
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
@@ -35,7 +36,16 @@ jobs:
3536
if git diff --quiet README.md; then
3637
echo "No SHA change detected, skipping commit."
3738
else
39+
BRANCH="chore/update-readme-sha-${{ github.sha }}"
40+
git checkout -b "${BRANCH}"
3841
git add README.md
3942
git commit -m "chore: update pinned SHA in README to ${{ github.sha }}"
40-
git push
43+
git push origin "${BRANCH}"
44+
gh pr create \
45+
--title "chore: update pinned SHA in README to ${{ github.sha }}" \
46+
--body "Automated update of the pinned commit SHA in the GitHub Actions usage example in README.md." \
47+
--base main \
48+
--head "${BRANCH}"
4149
fi
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)