actions / create-github-app-token

GitHub Action for creating a GitHub App Installation Access Token
https://github.com/marketplace/actions/create-github-app-token
MIT License
365 stars 53 forks source link

fix: do not revoke token if already expired #147

Closed wechuli closed 3 months ago

wechuli commented 3 months ago

Closes #140

The pull request at #95 introduced changes to avoid revoking expired tokens by saving the expiresAt value in the state. The change, however, used core.setOutput instead of core.setState meaning the value is not saved in the state but rather available in the output.

if (!skipTokenRevoke) {
    core.saveState("token", authentication.token);
    core.setOutput("expiresAt", authentication.expiresAt);
  }

This means that when we use the value downstream, it evaluates to an empty string and the following code block is never run:

 const expiresAt = core.getState("expiresAt"); 
 if (expiresAt && tokenExpiresIn(expiresAt) < 0) { 
   core.info("Token expired, skipping token revocation"); 
   return; 
 } 

This is a tiny PR to correct that typo.

create-app-token-action-releaser[bot] commented 3 months ago

:tada: This PR is included in version 1.10.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: