Skip to content

fix(ci): let update workflows open PRs and run their tests - #67

Merged
tsvikas merged 1 commit into
mainfrom
pr-workflows-dispatch-ci
Sep 27, 2026
Merged

tsvikas merged 1 commit into
mainfrom
pr-workflows-dispatch-ci

Conversation

@tsvikas

@tsvikas tsvikas commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Fixes the scheduled "Update template action pins" failure (run 33501670621): GitHub Actions is not permitted to create or approve pull requests.

Cause

The repo setting "Allow GitHub Actions to create and approve pull requests" was off, so peter-evans/create-pull-request using GITHUB_TOKEN could push the branch but not open the PR. It has been failing monthly since 2026-08-16. Generated projects' deps-update.yml uses the same pattern and would hit the same wall.

Changes

  • Repo setting (already applied, not part of the diff): turned on can_approve_pull_request_reviews. default_workflow_permissions stays read.
  • update-template-pins.yml and the template's deps-update.yml:
    • A header comment names the required setting, following the "configure trusted publishing" comment convention in build-and-publish.yml.
    • A PR opened with GITHUB_TOKEN triggers no pull_request workflows, so the automated PRs would show no CI. A new step dispatches the tests (uv-tests.yml / ci.yml) on the PR branch whenever the PR is created or updated, because workflow_dispatch is exempt from that rule. This needs actions: write on the job.

Verification

  • prek passes on both files (actionlint, zizmor, check-github-workflows, yamllint).
  • Not yet exercised on GitHub. After merging, run gh workflow run update-template-pins.yml and check that the pins PR opens and shows a Tests run on its head commit.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GyMoD8tx4oz1bpJ1tEL845

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. The workflow now grants its GITHUB_TOKEN actions: write and uses it to dispatch test workflows against update branches, changing both the token's trust boundary and what runs automatically. Reverting stops future dispatches, but any already-created pull requests, workflow runs, or unintended effects would remain and require cleanup.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

The scheduled template-pins run failed with "GitHub Actions is not
permitted to create or approve pull requests": that repo setting was off.
It is now on, and both PR-creating workflows (template pins, and the
generated deps-update) say so in a header comment.

A PR opened with GITHUB_TOKEN triggers no pull_request workflows, so
each now dispatches its test workflow on the PR branch; workflow_dispatch
is exempt from that rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GyMoD8tx4oz1bpJ1tEL845
@tsvikas
tsvikas force-pushed the pr-workflows-dispatch-ci branch from cd8c419 to b830307 Compare September 27, 2026 12:03
@tsvikas
tsvikas merged commit c556393 into main Sep 27, 2026
5 checks passed
@tsvikas
tsvikas deleted the pr-workflows-dispatch-ci branch September 27, 2026 12:09
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.

1 participant