Skip to content

Commit

Permalink
Update push-mimir-build-image.yml to use app token
Browse files Browse the repository at this point in the history
  • Loading branch information
armandgrillet committed Mar 5, 2025
1 parent b12c2fd commit 3d8c76a
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/push-mimir-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,27 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

# Retrieve GitHub App Credentials from Vault
- name: Retrieve GitHub App Credentials from Vault
id: get-secrets
uses: grafana/shared-workflows/actions/[email protected]
with:
repo_secrets: |
APP_ID=mimir-github-bot:app_id
PRIVATE_KEY=mimir-github-bot:private_key
# Generate GitHub App Token
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ env.APP_ID }}
private-key: ${{ env.PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Checkout Pull Request Branch
run: gh pr checkout ${{ github.event.pull_request.number }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

- name: Setup QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -76,7 +93,7 @@ jobs:
- name: Add Comment to the PR
id: notification
run: |
run: |
if [ ${{ steps.check_build.outputs.build }} == 'true' ]; then
gh pr comment $PR_NUMBER --body "**Building new version of mimir-build-image**. After image is built and pushed to Docker Hub, \
a new commit will automatically be added to this PR with new image version \`$IMAGE:$TAG\`. This can take up to 1 hour."
Expand All @@ -86,7 +103,7 @@ jobs:
fi
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
TAG: ${{ steps.compute_hash.outputs.tag }}
IMAGE: ${{ steps.prepare.outputs.image }}

Expand Down Expand Up @@ -126,6 +143,6 @@ jobs:
git push origin HEAD
fi
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
TAG: ${{ steps.compute_hash.outputs.tag }}
MAIN_TAG: ${{ steps.prepare.outputs.main_image_tag }}

0 comments on commit 3d8c76a

Please sign in to comment.