Skip to content

Commit dc9a11d

Browse files
committed
Use Github app for downstream triggering and whatnot.
1 parent 3b2cb0c commit dc9a11d

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

.github/workflows/build-and-publish.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,24 @@ jobs:
1111
steps:
1212
- name: Checkout code
1313
uses: actions/checkout@v3
14+
15+
- name: Generate GitHub App Token
16+
id: generate-token
17+
uses: actions/create-github-app-token@v1
18+
with:
19+
app-id: ${{ secrets.MADGRADES_AUTOMATOR_APP_ID }}
20+
private-key: ${{ secrets.MADGRADES_AUTOMATOR_PRIVATE_KEY }}
21+
1422
- name: Login to Github Packages
1523
uses: docker/login-action@v2
1624
with:
1725
registry: ghcr.io
18-
username: ${{ secrets.PUBLISHING_GITHUB_USERNAME }}
19-
password: ${{ secrets.PUBLISHING_GITHUB_TOKEN }}
26+
username: ${{ github.repository_owner }}
27+
password: ${{ steps.generate-token.outputs.token }}
2028
- name: Build image and push
2129
uses: docker/build-push-action@v2
2230
with:
2331
context: ./
2432
tags: |
2533
ghcr.io/madgrades/madgrades-data:latest
26-
push: ${{ github.ref == 'refs/heads/main' }}
34+
push: ${{ github.ref == 'refs/heads/main' }}

.github/workflows/trigger-downstream.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ jobs:
66
notify:
77
runs-on: ubuntu-latest
88
steps:
9+
- name: Generate GitHub App Token
10+
id: generate-token
11+
uses: actions/create-github-app-token@v1
12+
with:
13+
app-id: ${{ secrets.MADGRADES_AUTOMATOR_APP_ID }}
14+
private-key: ${{ secrets.MADGRADES_AUTOMATOR_PRIVATE_KEY }}
15+
916
- name: Trigger submodule-updated workflow in Madgrades/reports
1017
run: |
1118
curl -X POST \
1219
-H "Accept: application/vnd.github.v3+json" \
13-
-H "Authorization: token ${{ secrets.ACTIONS_GITHUB_TOKEN }}" \
20+
-H "Authorization: token ${{ steps.generate-token.outputs.token }}" \
1421
https://api.github.com/repos/Madgrades/reports/dispatches \
1522
-d '{"event_type":"submodule-updated"}'

0 commit comments

Comments
 (0)