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

feat: Add a skip_token_revoke input for configuring token revocation #54

Merged
merged 5 commits into from Oct 6, 2023
Merged

feat: Add a skip_token_revoke input for configuring token revocation #54

merged 5 commits into from Oct 6, 2023

Conversation

smockle
Copy link
Contributor

@smockle smockle commented Oct 3, 2023

Fixes #55

Currently, actions/create-github-app-token always/unconditionally revokes the installation access token in a post step, at the completion of the current job. This prevents tokens from being used in other jobs.

This PR makes this behavior configurable:

  • When the skip-token-revoke input is not specified (i.e. by default), the token is revoked in a post step (i.e. the current behavior).
  • When the skip-token-revoke input is set to a truthy value (e.g. "true"1), the token is not revoked in a post step.

This PR adds a test for the skip-token-revoke: "true" case.

This is configurable in other app token actions, e.g. tibdex/github-app-token and wow-actions/use-app-token.

Footnotes

  1. Note that "false" is also truthy: Boolean("false") is true. If we think that’ll potentially confuse folks, I can require skip-token-revoke to be set explicitly to "true".

@smockle smockle requested review from gr2m, parkerbxyz and a team as code owners October 3, 2023 17:29
@gr2m
Copy link
Contributor

gr2m commented Oct 3, 2023

I've seen this option but couldn't think of a use case for it. Do you know why it was added to tibdex/github-app-token or can you think of a use case when someone would need it?

No biggie but could you create an issue next time before putting in work into a pull request? That way we can have a discussion and avoid unnecessary work

@smockle
Copy link
Contributor Author

smockle commented Oct 3, 2023

I've seen this option but couldn't think of a use case for it…can you think of a use case when someone would need it?

No biggie but could you create an issue next time before putting in work into a pull request? That way we can have a discussion and avoid unnecessary work

@gr2m I opened #55, and I wrote about our use case there. Let’s move discussion there.

README.md Outdated
Comment on lines 70 to 72
### `revoke`

**Optional:** Whether to revoke the token when the current job is complete. Default: `"true"`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if revoke is the best possible argument for this feature. As the default is true. I think it might be more elegant to have an option that is not set by default at all, and needs to be set to overwrite it.

For example: do_not_revoke_token_after_job. Long but clear 🤷🏼

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or skip_token_revoke

Copy link
Contributor Author

@smockle smockle Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered the same thing! Either of those suggestions works for me.

The 5 actions I surveyed in https://github.com/github/core-ux/discussions/142#discussioncomment-7177238 (only accessible to Hubbers) (under “comparative analysis…”) didn’t reveal a widely-used name, but I’ll review the actions listed in #42 too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I think we should use dashes for our arguments, it seems to be the convention for actions/* actions, e.g. see https://github.com/actions/checkout/. So we would do skip-token-revoke

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gr2m The existing inputs use underscores—would we want to migrate those to dashes too?

Copy link
Contributor

@parkerbxyz parkerbxyz Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is a new feature for that action. The documentation isn't very clear about this, but it looks like the value of revoke is actually true by default.

I'm in favor of using revoke in the same way (as you did originally), but I don't feel strongly about it, so I'll leave it up to @gr2m.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay let's go with skip_token_revoke, let's have a separate discussion about whether to migrate arguments to dashes. I'd rather change it now when adaption is still early

Copy link
Contributor

@parkerbxyz parkerbxyz Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Just throwing out one more possible alternative name: do_not_revoke.

Take it or leave it; I don't feel strongly about this one either. 😄

Copy link
Contributor Author

@smockle smockle Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…let's have a separate discussion about whether to migrate arguments to dashes…

Opened #57 for this! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…let's go with skip_token_revoke

Done, via 5a2e1e7.

@smockle smockle changed the title feat: Add a revoke input for configuring token revocation feat: Add a skip_token_revoke input for configuring token revocation Oct 5, 2023
Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great PR, thank you for bearing with us 💐

@gr2m gr2m merged commit 9ec88c4 into actions:main Oct 6, 2023
2 checks passed
create-app-token-action-releaser bot pushed a commit that referenced this pull request Oct 6, 2023
# [1.4.0](v1.3.0...v1.4.0) (2023-10-06)

### Features

* Add a `skip_token_revoke` input for configuring token revocation ([#54](#54)) ([9ec88c4](9ec88c4)), closes [1#L46-L47](https://github.com/1/issues/L46-L47) [1#L132](https://github.com/1/issues/L132)
@create-app-token-action-releaser

🎉 This PR is included in version 1.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support opting-out of token revocation
3 participants