Skip to content

Commit

Permalink
fix: use app token because of PR / branch protection (#1283)
Browse files Browse the repository at this point in the history
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it
For issues the GITHUB_TOKEN is sufficient:
https://github.com/open-component-model/ocm/actions/runs/13160047944/job/36726209427.

For PRs the branch protection comes in place and the action fails:
https://github.com/open-component-model/ocm/actions/runs/13160047944/job/36726209427

Therefore we need to use the github app token from the ocm bot.
  • Loading branch information
morri-son authored Feb 6, 2025
1 parent a28bcb2 commit 258ecdf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/milestone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ jobs:
issues: write
pull-requests: write
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.OCMBOT_APP_ID }}
private_key: ${{ secrets.OCMBOT_PRIV_KEY }}
- name: Set milestone on issue
if: github.event.issue.state_reason == 'completed'
run: gh issue edit ${{ github.event.issue.number }} --milestone "$(date +"%Y-Q%q")" --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: Set milestone on pull request
if: github.event.pull_request.merged == true
run: gh pr edit ${{ github.event.pull_request.number }} --milestone "$(date +"%Y-Q%q")" --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ steps.generate_token.outputs.token }} # For PRs and branch protection the standard GITHUB_TOKEN is not sufficient

0 comments on commit 258ecdf

Please sign in to comment.