Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,60 @@ jobs:
if: ${{ needs.release-please.outputs.release_created }}
needs: [release-please]
permissions:
contents: read
contents: write
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: 'main'
fetch-depth: 0

- id: get-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@main
with:
repo_secrets: |
GITHUB_APP_ID=helper-bot:app-id
GITHUB_APP_PRIVATE_KEY=helper-bot:private-key

- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ env.GITHUB_APP_ID }}
private-key: ${{ env.GITHUB_APP_PRIVATE_KEY }}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: 'main'
token: '${{ steps.app-token.outputs.token }}'
fetch-depth: 0

- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'

- name: Update readme
run: |
git checkout -b helper-bot/readme-${{ needs.release-please.outputs.tag_name }}
TAG_HASH="$(git rev-parse ${{ needs.release-please.outputs.tag_name }})" TAG="${{ needs.release-please.outputs.tag_name }}" envsubst < ./docs/README.tmpl > ./README.md
git add README.md

- name: Commit changes
uses: grafana/github-api-commit-action@db25908818706393572c06ecd63c378e8561314d # v0.4.0
with:
commit-message: 'chore(readme): update readme for ${{ needs.release-please.outputs.tag_name }} [BOT]'
create-branch-on-remote: 'true'
token: ${{ steps.app-token.outputs.token }}
commit-message: 'chore(readme): update readme for ${{ needs.release-please.outputs.tag_name }} [BOT]'

- name: Create pull request
id: cpr
run: |
PR_URL=$(gh pr create --title "chore(readme): update readme for ${{ needs.release-please.outputs.tag_name }} [BOT]" --body "PR created automatically through release-please.yml workflow")
echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}

- name: Approve and auto-merge
run: gh pr review --approve "$PR_URL" && gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{steps.cpr.outputs.PR_URL}}
GH_TOKEN: ${{ github.token }}
Copy link

Copilot AI Apr 21, 2025

Choose a reason for hiding this comment

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

The auto-merge step uses a different token (${{ github.token }}) than earlier steps that rely on the app-token. Consider using the same token throughout to avoid potential permission inconsistencies.

Suggested change
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}

Copilot uses AI. Check for mistakes.
Loading