Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Pilot Lvl 1
Message 1 of 4

Bad Credentials GitHub Token Secret Expires

Sometimes when I try to authenticate using GITHUB_TOKEN it would result in a "Bad credentials" error because the token has already expired.  According to the documentation GitHub Actions fetches the token before the job begins, even if it's just sitting in the queue.  There doesn't seem to be a point to obtain a token before the job even starts.  Can GitHub change this behavior so the token is fetched when the job begins?

3 Replies
Highlighted
GitHub Partner
Message 2 of 4

Re: Bad Credentials GitHub Token Secret Expires

@chingc ,

Thanks for your feedback.

GitHub takes your suggestions very seriously, and the suggestions are very helpful for improving GitHub.
I recommend you directly share your suggestion here. That will allow you to directly interact with the appropriate engineering team, and make it more convenient for the engineering team to collect and categorize your suggestions.

Highlighted
Copilot Lvl 2
Message 3 of 4

Re: Bad Credentials GitHub Token Secret Expires

It seems that token is issued when job is queued, not started. So, basically from the beginning of the workflow. If job is queued for more than hour, token expires :(

Only workaround I found is to create personal access token, add it to secrets (say, `PAT`), and use `${{ secrets.PAT }}` instead:

      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.PAT }}
        with:
          tag_name: ${{ github.ref }}
          ....

But this is suboptimal, because results would be from your name, not from name of the action bot :(

Highlighted
Pilot Lvl 1
Message 4 of 4

Re: Bad Credentials GitHub Token Secret Expires

@Shchvova Yeah, I'm using a PAT right now to workaround this problem too.  I've submitted feedback to have this behavior changed like @BrightRan suggested.  I haven't heard back, but hopefully they'll do something.