Skip to content

Commit

Permalink
github-actions: use ephemeral github tokens (#2469)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored Oct 23, 2024
1 parent c142a4f commit 582d500
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ on:
types: [published]

permissions:
contents: write
issues: write
pull-requests: write
contents: read

env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
Expand Down Expand Up @@ -163,20 +161,37 @@ jobs:
needs: [ 'release-windows']
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_TAG: v${{ needs.release-windows.outputs.agent-version }}
NEW_BRANCH: update/${{ needs.release-windows.outputs.agent-version }}
TARGET_BRANCH: ${{ needs.release-windows.outputs.major-version }}.x

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: >-
["apm-agent-dotnet"]
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.get_token.outputs.token }}

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

- name: Create GitHub Pull Request if minor release.
env:
GH_TOKEN: ${{ steps.get_token.outputs.token }}
run: |
echo "as long as there is a major.x branch"
existed_in_local=$(git ls-remote --heads origin ${TARGET_BRANCH})
Expand Down

0 comments on commit 582d500

Please sign in to comment.