Skip to content

chore: Update GitHub Actions workflows to use fallback token and add permissions#42

Merged
sachin-spotdraft merged 1 commit intomainfrom
fix-github-ci
Mar 26, 2026
Merged

chore: Update GitHub Actions workflows to use fallback token and add permissions#42
sachin-spotdraft merged 1 commit intomainfrom
fix-github-ci

Conversation

@sachin-spotdraft
Copy link
Copy Markdown
Contributor

@sachin-spotdraft sachin-spotdraft commented Mar 26, 2026

User description

  • Modified workflows to use a fallback for the GitHub token, allowing for better access management.
  • Added necessary permissions for write access to contents and issues in relevant workflows.

Generated description

Below is a concise technical summary of the changes proposed in this PR:
Adjust the cherrypick, create-release, and promote-to-prod workflows to rely on a fallback token and explicit contents permissions so the tag and checkout steps keep working when the bot PAT is unavailable. Ensure the labeler, remove-labels, and stale jobs request issues/pull-requests permissions and mirror that fallback so automation can run without the dedicated secret.

TopicDetails
Release tagging Adjust cherrypick, create-release, and promote-to-prod flows to request contents write and fall back to github.token for checkout and tagging, keeping tag pushes stable even when GH_BOT_PAT is unavailable.
Modified files (3)
  • .github/workflows/cherrypick.yaml
  • .github/workflows/create-release.yaml
  • .github/workflows/promote-to-prod.yaml
Latest Contributors(1)
UserCommitDate
sachin.rathod@spotdraf...Cicd (#22)February 04, 2026
Label automation Update PR labeler, remove-labels, and stale jobs to request the necessary issues/pull-requests permissions and reuse the github.token fallback so labeling automation keeps working without the bot PAT.
Modified files (3)
  • .github/workflows/pr-labeler.yaml
  • .github/workflows/remove-label.yaml
  • .github/workflows/stale-pr-labeler.yaml
Latest Contributors(1)
UserCommitDate
sachin.rathod@spotdraf...cicd (#21)February 04, 2026
This pull request is reviewed by Baz. Review like a pro on (Baz).

…permissions

- Modified workflows to use a fallback for the GitHub token, allowing for better access management.
- Added necessary permissions for write access to contents and issues in relevant workflows.
@sachin-spotdraft sachin-spotdraft merged commit 8db0b84 into main Mar 26, 2026
6 checks passed
Comment on lines 4 to 15
autolabeler:
runs-on: [ubicloud-standard-2]
name: PR size Workflows
permissions:
issues: write
pull-requests: read
steps:
- uses: actions/checkout@v6
- uses: codelytv/pr-size-labeler@v1
with:
GITHUB_TOKEN: ${{ secrets.GH_BOT_PAT }}
GITHUB_TOKEN: ${{ secrets.GH_BOT_PAT || github.token }}
xs_label: 'size/xs'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GITHUB_TOKEN: ${{ secrets.GH_BOT_PAT || github.token }} falls back to read-only github.token on fork PRs and permissions lacks pull-requests: write — should we require the PAT, add pull-requests: write, and guard fork PRs with an if condition?

Finding types: Logical Bugs | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Fix in Cursor

Prompt for AI Agents:

Before applying, verify this suggestion against the current code. In
.github/workflows/pr-labeler.yaml around lines 4-16, the autolabeler job currently falls
back to GITHUB_TOKEN: ${{ secrets.GH_BOT_PAT || github.token }} which is read-only for
forked PRs and the permissions block sets pull-requests: read instead of pull-requests:
write. Change the job to: (1) update the permissions block to include both issues: write
and pull-requests: write so the codelytv/pr-size-labeler action can modify PR labels,
(2) remove the github.token fallback and require GITHUB_TOKEN: ${{ secrets.GH_BOT_PAT }}
or alternatively switch to the pull_request_target event with the PAT, and (3) add an if
condition to the labeling step so it only runs when either the PR is not from a fork
(github.event.pull_request.head.repo.fork == false) or when secrets.GH_BOT_PAT is
present. Optionally add a debug/log step that warns and skips labeling when neither
condition is met.

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