Skip to content

Commit cab9e03

Browse files
committed
use app authentication instead of PAT
1 parent 60815a8 commit cab9e03

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/workflows/sync.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,17 @@ jobs:
2222
run: pip install github-org-manager
2323
- name: Display information about github-org-manager
2424
run: gh-org-mgr --version
25+
# Make a dry run in pull requests
26+
- name: Synchronise settings with github-org-manager (pull request, dry)
27+
if: github.event_name == 'pull_request'
28+
run: gh-org-mgr sync -c . --dry
29+
# Get app private key from secrets, set as environment variable
30+
env:
31+
GITHUB_APP_PRIVATE_KEY: ${{ secrets.GTHB_APP_PRIVATE_KEY }}
2532
# Only effectively sync on main branch
26-
- name: Configure application, add login credentials
27-
run: sed -i "s|__GITHUB_TOKEN__|${{ secrets.GTHB_TOKEN }}|" app.yaml
28-
- name: Synchronise settings with github-org-manager
33+
- name: Synchronise settings with github-org-manager (main branch, prod)
2934
if: github.ref == 'refs/heads/main'
3035
run: gh-org-mgr sync -c .
36+
# Get app private key from secrets, set as environment variable
37+
env:
38+
GITHUB_APP_PRIVATE_KEY: ${{ secrets.GTHB_APP_PRIVATE_KEY }}

app.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
# Personal Oauth access token with required scopes
66
# The current token, stored as repository secret, is owned by @mxmehl and will expire on 2025-05-02
7-
github_token: __GITHUB_TOKEN__
7+
# github_token:
8+
9+
# GitHub App (if this is set, the personal access token (github_token) will be ignored)
10+
github_app_id: 1075380
11+
github_app_private_key: # set as environment variable from secrets

0 commit comments

Comments
 (0)