Skip to content

Commit eba0e40

Browse files
authored
chore: replace PAT tokens with GitHub App token (#1198)
Replace secrets.PAT_TOKEN and secrets.AUTOMATION_ACCOUNT_PAT_TOKEN with short-lived tokens generated by the agentcore-devx-automation GitHub App (ID: 3637953) via actions/create-github-app-token@v1. This improves security by using ephemeral tokens scoped to the installation rather than long-lived personal access tokens. Requires adding repo variable APP_ID=3637953 and repo secret APP_PRIVATE_KEY with the app's RSA private key.
1 parent 340878c commit eba0e40

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/agent-restricted.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ jobs:
6666
6767
- uses: actions/checkout@v6
6868

69+
- name: Generate GitHub App Token
70+
id: app-token
71+
uses: actions/create-github-app-token@v1
72+
with:
73+
app-id: ${{ vars.APP_ID }}
74+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
75+
6976
- name: Run Strands Agent
7077
uses: ./.github/actions/strands-action
7178
with:
@@ -78,6 +85,6 @@ jobs:
7885
agent_runner: ${{ inputs.agent_runner }}
7986
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
8087
aws_region: 'us-west-2'
81-
pat_token: ${{ secrets.PAT_TOKEN }}
88+
pat_token: ${{ steps.app-token.outputs.token }}
8289
env:
8390
STRANDS_TOOLS_DIRECTORY: 'true'

.github/workflows/ci-failure-issue.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,16 @@ jobs:
1919
permissions:
2020
issues: write
2121
steps:
22+
- name: Generate GitHub App Token
23+
id: app-token
24+
uses: actions/create-github-app-token@v1
25+
with:
26+
app-id: ${{ vars.APP_ID }}
27+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
28+
2229
- uses: actions/github-script@v9
2330
with:
24-
github-token: ${{ secrets.AUTOMATION_ACCOUNT_PAT_TOKEN }}
31+
github-token: ${{ steps.app-token.outputs.token }}
2532
script: |
2633
try {
2734
const workflowName = context.payload.workflow_run.name;

0 commit comments

Comments
 (0)