Skip to content

Commit 363959d

Browse files
committed
replaced long running access token
replace long running access token by ephemeral (1h) tokens via integration with an Erlang Bot App.
1 parent eed08bf commit 363959d

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

.github/scripts/create-openvex-pr.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ if [ "$FOUND_PR" -ne 0 ]; then
3232
echo "A new PR will be created"
3333
fi
3434

35-
git config user.name "github-actions[bot]"
36-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
37-
3835
# Check if PR is closed
3936
if [ "$PR_STATUS" = "CLOSED" ] || [ "$PR_STATUS" = "MERGED" ] || [ "$FOUND_PR" -ne 0 ]; then
4037
echo "Pull request #$BRANCH_NAME is CLOSED or MERGED."

.github/workflows/openvex-sync.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
## Periodically syncs OpenVEX files against Erlang OTP Securities,
2222
## creating an automatic PR with the missing published securities.
2323
name: OpenVEX Securities Syncing
24+
description: 'Sync OpenVEX Securities with Erlang/OTP published Securities'
2425

2526
on:
2627
workflow_dispatch:
@@ -43,21 +44,35 @@ jobs:
4344
with:
4445
ref: 'master' # '' = default branch
4546

46-
- uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451 # racket:actions/checkout@v1
47+
- uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451 # ratchet:actions/checkout@v1
4748
with:
4849
otp-version: '28'
4950

5051
- uses: openvex/setup-vexctl@e85ca48f3c8a376289f6476129d59cda82147e71 # ratchet:openvex/[email protected]
5152
with:
5253
vexctl-release: '0.3.0'
5354

55+
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # ratchet:actions/[email protected]
56+
id: app-token
57+
with:
58+
# required
59+
app-id: ${{ vars.ERLANG_BOT_APP_ID }}
60+
private-key: ${{ secrets.ERLANG_BOT_PRIVATE_KEY }}
61+
5462
- name: Authenticate gh
5563
run: |
56-
echo "${{ secrets.OPENVEX_TOKEN }}" | gh auth login --with-token
64+
echo "${{ steps.app-token.outputs.token }}" | gh auth login --with-token
65+
66+
- name: Get GitHub App User ID
67+
id: get-user-id
68+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
69+
env:
70+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
71+
72+
- run: |
73+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
74+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
5775
5876
- name: 'Open OpenVEX Pull Requests for newly released vulnerabilities'
5977
run: |
6078
.github/scripts/otp-compliance.es vex verify -p
61-
# env:
62-
# GH_TOKEN: ${{ secrets.OPENVEX_TOKEN }}
63-
# REPO: ${{ github.repository }}

0 commit comments

Comments
 (0)