github-app-token
github-app-token copied to clipboard
fix: Don't try to revoke a token that has already expired
This is a PR to fix when a CI job fails because it tries to revoke a token which has already expired. Given that github provides the expiration time, it's worth referencing that and preventing the error in the first place.
Testing
This was tested using an internal repostiory, below are the workflow files and the results:
Skipping revoke as it's expired
name: Testing app rejection update
on:
push:
branches:
- sean-smith-test
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: Setup app token
uses: wwsean08/github-app-token@v2
with:
app_id: ${{ secrets.APP_READ_ALL_REPOS_ID }}
private_key: ${{ secrets.APP_READ_ALL_REPOS_KEY_B64 }}
- name: Sleep for about an hour
run: sleep 61m
Revoking as it's not expired
name: Testing app rejection update
on:
push:
branches:
- sean-smith-test
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: Setup app token
uses: wwsean08/github-app-token@v2
with:
app_id: ${{ secrets.APP_READ_ALL_REPOS_ID }}
private_key: ${{ secrets.APP_READ_ALL_REPOS_KEY_B64 }}
- name: Sleep for about an hour
run: sleep 5