Fixes #72 If an Actions job is long enough, more than an hour can pass between creating and revoking the App token in the post-job clean up step. Since the token itself is used to authenticate with the revoke API, an expired token will fail to be revoked. This PR saves the token expiration in the actions state and uses that in the post step to determine if the token can be revoked. I've also added error handling to the revoke token API call, as it's unlikely that users would want their job to fail if the token can't be revoked.
5.3 KiB
5.3 KiB
Snapshot report for tests/index.js
The actual snapshot is saved in index.js.snap.
Generated by AVA.
action-deprecated-inputs.test.js
stderr
''
stdout
`app_id — 'app_id' is deprecated and will be removed in a future version. Use 'app-id' instead.␊
private_key — 'private_key' is deprecated and will be removed in a future version. Use 'private-key' instead.␊
skip_token_revoke — 'skip_token_revoke' is deprecated and will be removed in a future version. Use 'skip-token-revoke' instead.`
main-missing-app-id.test.js
stderr
'Input required and not supplied: app-id'
stdout
''
main-missing-owner.test.js
stderr
'GITHUB_REPOSITORY_OWNER missing, must be set to \'<owner>\''
stdout
''
main-missing-private-key.test.js
stderr
'Input required and not supplied: private-key'
stdout
''
main-missing-repository.test.js
stderr
'GITHUB_REPOSITORY missing, must be set to \'<owner>/<repo>\''
stdout
''
main-token-get-owner-set-repo-fail-response.test.js
stderr
''
stdout
`owner and repositories set, creating token for repositories "failed-repo" owned by "actions"␊
Failed to create token for "failed-repo" (attempt 1): GitHub API not available␊
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
main-token-get-owner-set-repo-set-to-many.test.js
stderr
''
stdout
`owner and repositories set, creating token for repositories "actions/create-github-app-token,actions/toolkit" owned by "actions"␊
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
main-token-get-owner-set-repo-set-to-one.test.js
stderr
''
stdout
`owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␊
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
main-token-get-owner-set-to-org-repo-unset.test.js
stderr
''
stdout
`repositories not set, creating token for all repositories for given owner "actions"␊
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
main-token-get-owner-set-to-user-fail-response.test.js
stderr
''
stdout
`repositories not set, creating token for all repositories for given owner "smockle"␊
Failed to create token for "smockle" (attempt 1): GitHub API not available␊
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
main-token-get-owner-set-to-user-repo-unset.test.js
stderr
''
stdout
`repositories not set, creating token for all repositories for given owner "smockle"␊
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
main-token-get-owner-unset-repo-set.test.js
stderr
''
stdout
`owner not set, creating owner for given repositories "actions/create-github-app-token" in current owner ("actions")␊
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
main-token-get-owner-unset-repo-unset.test.js
stderr
''
stdout
`owner and repositories not set, creating token for the current repository ("create-github-app-token")␊
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
post-revoke-token-fail-response.test.js
stderr
''
stdout
'::warning::Token revocation failed: '
post-token-expired.test.js
stderr
''
stdout
'Token expired, skipping token revocation'
post-token-set.test.js
stderr
''
stdout
'Token revoked'
post-token-skipped.test.js
stderr
''
stdout
'Token revocation was skipped'
post-token-unset.test.js
stderr
''
stdout
'Token is not set'