Skip to content

Commit 9b8d4bc

Browse files
committed
ci: use gh app ephemeral tokens
1 parent 83ab249 commit 9b8d4bc

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

.github/workflows/addToProject.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,20 @@ jobs:
1111
if: github.event.issue && github.event.issue.milestone
1212
runs-on: ubuntu-latest
1313
steps:
14+
- name: Get token
15+
id: get_token
16+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
17+
with:
18+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
19+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
20+
permissions: >-
21+
{
22+
"organization_projects": "write",
23+
"issues": "read"
24+
}
1425
- name: Get project data
1526
env:
16-
GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }}
27+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
1728
TEAM: Node.js
1829
ORGANIZATION: elastic
1930
PROJECT_NUMBER: 595
@@ -49,7 +60,7 @@ jobs:
4960
5061
- name: Add issue to project
5162
env:
52-
GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }}
63+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
5364
ISSUE_ID: ${{ github.event.issue.node_id }}
5465
run: |
5566
item_id="$( gh api graphql -f query='
@@ -65,7 +76,7 @@ jobs:
6576
6677
- name: Set fields
6778
env:
68-
GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }}
79+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
6980
run: |
7081
gh api graphql -f query='
7182
mutation (

.github/workflows/labeler.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,23 @@ jobs:
1515
triage:
1616
runs-on: ubuntu-latest
1717
steps:
18+
- name: Get token
19+
id: get_token
20+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
21+
with:
22+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
23+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
24+
permissions: >-
25+
{
26+
"members": "read"
27+
}
28+
1829
- id: is_elastic_member
1930
uses: elastic/oblt-actions/github/is-member-of@v1
2031
with:
2132
github-org: "elastic"
2233
github-user: ${{ github.actor }}
23-
github-token: ${{ secrets.APM_TECH_USER_TOKEN }}
34+
github-token: ${{ steps.get_token.outputs.token }}
2435

2536
- name: Add community and triage labels
2637
if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]'

0 commit comments

Comments
 (0)