Is it possible to reuse app token across jobs? #187570
-
Why are you starting this discussion?Question What GitHub Actions topic or product is this about?Workflow Configuration Discussion DetailsI'm using create-github-app-token action and generate tokens per job. I tempted to generate app token once and share across job because it feels like duplicates, but don't think it's secure nor practical. Am I right or not? jobs:
job1:
steps:
- name: Generate app token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout current branch
uses: actions/checkout@v6
with:
ref: ${{ github.ref }}
submodules: "recursive"
token: ${{ steps.app-token.outputs.token }}
# ...
job2:
steps:
- name: Generate app token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout current branch
uses: actions/checkout@v6
with:
ref: ${{ github.ref }}
submodules: "recursive"
token: ${{ steps.app-token.outputs.token }}
# ... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
GitHub app tokens are short-lived and job-specific. You can't reuse the same token across jobs. Instead, generate a fresh token in each job using the create-github-app-token action. Provide your app ID and private key as secrets. |
Beta Was this translation helpful? Give feedback.
GitHub app tokens are short-lived and job-specific. You can't reuse the same token across jobs. Instead, generate a fresh token in each job using the create-github-app-token action. Provide your app ID and private key as secrets.