Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't try to revoke a token that has already expired #109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wwsean08
Copy link

@wwsean08 wwsean08 commented Apr 1, 2024

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

Screenshot 2024-04-01 at 3 39 47 PM

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

Screenshot 2024-04-01 at 3 41 06 PM

@wwsean08 wwsean08 changed the title WIP: fix: Don't try to revoke a token that has already expired fix: Don't try to revoke a token that has already expired Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants