Skip to content

ci: open PR instead of direct push in dependabot update workflow#424

Merged
DennisOSRM merged 2 commits intogh-pagesfrom
copilot/change-workflow-to-open-pr
Apr 26, 2026
Merged

ci: open PR instead of direct push in dependabot update workflow#424
DennisOSRM merged 2 commits intogh-pagesfrom
copilot/change-workflow-to-open-pr

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 26, 2026

The scheduled dependency update workflow was pushing directly to gh-pages, which is a protected branch requiring PRs and status checks — causing the workflow to fail with GH006: Protected branch update failed.

Changes

  • Replaced direct push with PR flow: instead of git push to gh-pages, the workflow now creates a timestamped branch (chore/update-dependencies-<YYYYMMDD-HHMMSS>) and opens a PR against gh-pages via gh pr create
  • Unique branch names: uses %Y%m%d-%H%M%S to avoid collisions on repeated same-day runs
- name: Commit and open PR
  env:
    GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  run: |
    ...
    BRANCH="chore/update-dependencies-$(date +%Y%m%d-%H%M%S)"
    git checkout -b "$BRANCH"
    git add -A
    git commit -m "chore: update dependencies"
    git push origin "$BRANCH"
    gh pr create \
      --base gh-pages \
      --head "$BRANCH" \
      --title "chore: update dependencies" \
      --body "Automated dependency update via \`npm update\` and bundle rebuild."

The pull-requests: write permission was already present on the workflow, so no permissions changes were needed.

@DennisOSRM DennisOSRM marked this pull request as ready for review April 26, 2026 05:32
Copilot AI review requested due to automatic review settings April 26, 2026 05:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the scheduled dependency update workflow to avoid direct pushes to the protected gh-pages branch by creating a dedicated update branch and opening a PR instead.

Changes:

  • Replace git push to the protected branch with a timestamped branch push + gh pr create.
  • Add GH_TOKEN so the GitHub CLI can authenticate when creating the PR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

git config user.email "github-actions[bot]@users.noreply.github.com"

if ! git diff --quiet; then
Comment on lines +50 to +52
gh pr create \
--base gh-pages \
--head "$BRANCH" \
@DennisOSRM DennisOSRM merged commit aaee5ad into gh-pages Apr 26, 2026
9 checks passed
@DennisOSRM DennisOSRM deleted the copilot/change-workflow-to-open-pr branch April 26, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants