Skip to content

Commit f40f31d

Browse files
authored
fix(ci): use PR instead of direct push for Nix version update (#71)
The update-nix job was pushing directly to master, which is blocked by branch protection rules. Replace the direct push with a workflow that creates a dedicated branch and opens a Pull Request. Closes #63
1 parent 6824d62 commit f40f31d

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,14 +660,15 @@ jobs:
660660
661661
# ── Update Nix package versions ────────────────────────────────────
662662
# Updates packaging/nix/versions.json with the new release hashes and
663-
# commits back to master so `nix run github:vmvarela/sql-pipe` always
663+
# opens a Pull Request so `nix run github:vmvarela/sql-pipe` always
664664
# points to the latest version.
665665
update-nix:
666666
name: Update Nix package
667667
needs: checksums
668668
runs-on: ubuntu-latest
669669
permissions:
670670
contents: write
671+
pull-requests: write
671672
steps:
672673
- uses: actions/checkout@v6
673674
with:
@@ -718,10 +719,21 @@ jobs:
718719
echo "==> Updated Nix versions.json for sql-pipe ${VERSION}:"
719720
cat packaging/nix/versions.json
720721
721-
- name: Commit and push
722+
- name: Open Pull Request
723+
env:
724+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
722725
run: |
726+
BRANCH="chore/nix-update-${{ github.ref_name }}"
723727
git config user.name "github-actions[bot]"
724728
git config user.email "github-actions[bot]@users.noreply.github.com"
729+
git checkout -b "${BRANCH}"
725730
git add packaging/nix/versions.json
726-
git diff --cached --quiet || git commit -m "chore(nix): update to ${{ github.ref_name }}"
727-
git push
731+
git diff --cached --quiet && echo "No changes to commit." && exit 0
732+
git commit -m "chore(nix): update versions.json to ${{ github.ref_name }}"
733+
git push origin "${BRANCH}"
734+
gh pr create \
735+
--base master \
736+
--head "${BRANCH}" \
737+
--title "chore(nix): update versions.json to ${{ github.ref_name }}" \
738+
--body "Automated update of \`packaging/nix/versions.json\` hashes for release \`${{ github.ref_name }}\`." \
739+
--label "type:chore"

0 commit comments

Comments
 (0)