Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use GitHub app for ephemeral tokens #357

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 19 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,30 @@ jobs:
name: Post Release
needs: release
runs-on: ubuntu-latest
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: >-
["${{github.repository}}"]
v1v marked this conversation as resolved.
Show resolved Hide resolved

- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_specifier || 'main' }}
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 }}

- uses: ./.github/actions/setup
- if: ${{ ! inputs.dry_run }}
run: ./gradlew postDeploy -Prelease=true -Pversion_override=${{ inputs.version_override_specifier || '' }}
23 changes: 19 additions & 4 deletions .github/workflows/updateVersionBranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,36 @@ on:
- closed

permissions:
contents: write
contents: read

jobs:
if_merged_postDeploy:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'post-release/')
runs-on: ubuntu-latest
name: Create PR to update version branch
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: >-
["${{github.repository}}"]
v1v marked this conversation as resolved.
Show resolved Hide resolved

- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.get_token.outputs.token }}

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

- uses: actions-ecosystem/action-regex-match@v2
id: major-version
Expand All @@ -39,5 +54,5 @@ jobs:
git push -u origin $CONFLICT_RESOLUTION_BRANCH
gh pr create --base ${{ env.BASE_BRANCH }} --title 'Merge main into version branch' --body 'Created by Github action :robot:' --reviewer elastic/apm-agent-android
env:
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
GH_TOKEN: ${{ steps.get_token.outputs.token }}
BASE_BRANCH: "${{ steps.major-version.outputs.group1 }}.x"
Loading