Skip to content

Migrate versioning workflow from PAT to GitHub App token#640

Draft
anth-volk wants to merge 1 commit intomainfrom
fix/fix-us-data-pypi
Draft

Migrate versioning workflow from PAT to GitHub App token#640
anth-volk wants to merge 1 commit intomainfrom
fix/fix-us-data-pypi

Conversation

@anth-volk
Copy link
Copy Markdown
Collaborator

Fixes #638

Summary

  • Replaced expired PAT (POLICYENGINE_GITHUB) with a GitHub App token in the versioning workflow
  • Uses actions/create-github-app-token@v1 with APP_ID and APP_PRIVATE_KEY secrets (already configured in the repo)
  • Matches the pattern used in policyengine-api-v2-alpha

Test plan

  • Merge a PR with a changelog fragment and verify the versioning workflow successfully pushes the "Update package version" commit
  • Verify that commit triggers code_changes.yaml and the PyPI publish step runs

🤖 Generated with Claude Code

Fixes #638. The versioning workflow used a PAT (POLICYENGINE_GITHUB)
to push the "Update package version" commit, which broke when the
token expired. Switch to a GitHub App token via
actions/create-github-app-token@v1, matching the pattern used in
policyengine-api-v2-alpha.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@anth-volk anth-volk marked this pull request as ready for review March 26, 2026 22:47
@anth-volk anth-volk requested a review from juaristi22 March 26, 2026 22:47
Copy link
Copy Markdown
Collaborator

@baogorek baogorek left a comment

Choose a reason for hiding this comment

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

Claude aggressively posted this comment on my behalf:

One thing I initially flagged: the `EndBug/add-and-commit@v9` step doesn't explicitly receive the app token — so I worried it might fall back to the default `GITHUB_TOKEN` for the push, which wouldn't trigger downstream workflows (like PyPI publish via `code_changes.yaml`).

After digging in, this is not a concern. Here's why:

- `actions/checkout@v4` with `token: <app-token>` persists that token into the local git config via an `http.extraheader` credential (this is the default `persist-credentials: true` behavior).
- `EndBug/add-and-commit@v9` just shells out to `git push` — it uses whatever credentials the local repo already has configured. Its `github_token` input is only used for GitHub API calls (fetching user info for commit metadata), not for git operations.
- Their README confirms: *"When pushing, the action uses the token that the local git repository has been configured with."*

So the version-bump commit will be pushed with the GitHub App token, which will correctly trigger subsequent workflow runs. LGTM.

So an LGTM is coming and I'll try to get this in before I go to sleep tonight.

Copy link
Copy Markdown
Collaborator

@baogorek baogorek left a comment

Choose a reason for hiding this comment

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

Left a note about Claude's anxiousness about a token carrying over, but an LGTM from the human.

@juaristi22
Copy link
Copy Markdown
Collaborator

There are other workflow files like reusable_tests.yaml that use similar tokens like secrets.POLICYENGINE_US_DATA_GITHUB_TOKEN or code_changes.yaml (which also seems responsible for publishing), that might also be affected by this. I'm not sure whether we want to trigger the entire test suite again on main (considering costs) now that we have the constraint that PRs need to be approved before merging. It might be worth reviewing the entire workflow now that running the pipeline has come in?

(Eg, the test suite was also responsible for publishing datasets, but now the pipeline run also does that, we might want to decide on a single responsible step -- we are overwriting them anyway otherwise). What do you think @baogorek @anth-volk ?

@anth-volk
Copy link
Copy Markdown
Collaborator Author

@juaristi22 This was just a minimal fix, as I figured PyPI publishing might be important to have working again. I don't think the current CI/CD pipeline is sufficient. I could transform this PR into that, or do separately, but would be happy to propose a solution unless anyone else is super eager to do the plumbing.

@anth-volk anth-volk marked this pull request as draft March 27, 2026 16:38
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.

Fix versioning workflow: migrate from expired PAT to GitHub App token

3 participants