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

Github token lifetime?

Solved! Go to Solution.

I'm working on a workflow with a fairly long build and I'm seeing failures in code designed to interact with the PR (adding a comment with a link to the build result) at the end of the build.

 

I'm running the workflow on Mac and PC and both flows use the same python script set up with the same environment variables in order to upload the build to S3 and then post a comment on the PR.  

 

The Mac build takes about a half hour and completes fine.  The PC build takes about 1 hour and 15 minutes before it runs the script at which point the script throws an exception:

 

401 {"message": "Bad credentials", "documentation_url": "https://developer.github.com/v3"}

 

If I alter the build so it skips some of the longer duration components (and thus completes in less than an hour) it runs fine.  So I'm guessing that the token created for the workflow only has a lifetime of about an hour?  Github workflows are allowed to run for up to 6 hours though, so it seems like the token lifetime should be at least that long. 

1 Reply
Solution
Copilot Lvl 3
Message 2 of 2

Re: Github token lifetime?

Indeed, the token expires after 1 hour. From https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-...:

 

"The GITHUB_TOKEN secret is a GitHub App installation access token."

and

"The installation access token expires after 60 minutes."