Skip to content

fix: expose GITHUB_TOKEN in bulk_repo_update run script step#226

Open
irfanuddinahmad wants to merge 1 commit into
openedx:masterfrom
irfanuddinahmad:iahmad/165
Open

fix: expose GITHUB_TOKEN in bulk_repo_update run script step#226
irfanuddinahmad wants to merge 1 commit into
openedx:masterfrom
irfanuddinahmad:iahmad/165

Conversation

@irfanuddinahmad
Copy link
Copy Markdown

Summary

  • Adds GITHUB_TOKEN to the env block of the run script step in bulk_repo_update.yml
  • Allows scripts that call the GitHub API (e.g. pinact for SHA resolution) to authenticate without embedding token handling in the script input itself
  • Backward-compatible — existing workflow usages are unaffected

Context

Part of the org-wide GitHub Actions SHA-pinning migration: #165

The immediate use case is running pinact run via this workflow to bulk-pin all uses: action refs to full commit SHAs across openedx repos. pinact requires a GitHub token to resolve tags → SHAs via the API.

Test plan

  • Trigger bulk_repo_update.yml on a single test repo with script: pinact run after merging — confirm pinact resolves SHAs without auth errors

🤖 Generated with Claude Code

Allows scripts that need GitHub API access (e.g. pinact for SHA
resolution) to authenticate without extra setup in the script itself.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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

This PR updates the Bulk Repo Update GitHub Actions workflow to expose a GitHub API token to the user-provided script step, enabling tools like pinact to authenticate when resolving tags to SHAs as part of the org-wide SHA-pinning migration (#165).

Changes:

  • Adds an env block to the run script step to set GITHUB_TOKEN from secrets.requirements_bot_github_token.

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

Comment on lines 109 to 112
- name: run script
env:
GITHUB_TOKEN: ${{ secrets.requirements_bot_github_token }}
run: ${{ github.event.inputs.script }}
Copy link
Copy Markdown

@farhan farhan left a comment

Choose a reason for hiding this comment

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

PR seems alright

point is should we expose the github_token for the script?

run: pip install ${{ github.event.inputs.packages }}

- name: run script
env:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sharing claude view on the exposure of this github token in the script:

The PR's intent is legitimate (pinact needs a token to resolve SHAs). But the
implementation exposes a high-privilege org-wide bot token to an unrestricted freeform
script execution step, which is a significant escalation of the pre-existing arbitrary
code execution risk. The token should be scoped to a dedicated, purpose-specific step
rather than the generic run script step.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agreed, rather than giving it the bot token, we can have github actions generate a read-only token which is all this should need.

https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions

@farhan farhan requested a review from kdmccormick May 7, 2026 12:42
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.

4 participants