Skip to content

Commit

Permalink
ci: use GitHub app for ephemeral tokens (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored Sep 25, 2024
1 parent d8905de commit d0b2cfe
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/pre-post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,29 @@ jobs:
runs-on: ubuntu-latest
needs:
- validate-tag
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
steps:
- name: Get token
id: get_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
with:
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
permissions: >-
{
"contents": "write",
"pull_requests": "write"
}
repositories: >-
["ecs-logging-java"]
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
token: ${{ env.GITHUB_TOKEN }}
token: ${{ steps.get_token.outputs.token }}

- uses: elastic/oblt-actions/git/setup@v1
with:
github-token: ${{ steps.get_token.outputs.token }}

- name: Create the release tag (post phase)
if: inputs.phase == 'post'
Expand Down Expand Up @@ -93,4 +105,4 @@ jobs:
- name: Create the ${{ inputs.phase }} release PR
run: gh pr create --title="${{ inputs.pr_title }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.pr_body }}"
env:
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
GH_TOKEN: ${{ steps.get_token.outputs.token }}

0 comments on commit d0b2cfe

Please sign in to comment.