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

Support GitHub Actions #621

Merged
merged 8 commits into from Mar 19, 2020
Merged

Support GitHub Actions #621

merged 8 commits into from Mar 19, 2020

Conversation

vinsidious
Copy link
Contributor

Overview

This PR adds support for running release-it on GitHub Actions and fixes #618.

Background

When running on GitHub Actions, GitHub injects the GITHUB_TOKEN environment variable automatically. This token differs from typical GitHub user tokens in the following ways:

Because of this, we need to skip the user authentication and collaborator checks when we're running on GitHub Actions.

Example of this running successfully

Screen Shot 2020-03-17 at 1 12 49 PM

@webpro
Copy link
Collaborator

webpro commented Mar 18, 2020

Thanks, @vinsidious! What's the reason you made the variable part of the global config? I think we can/should keep its scope entirely within the GitHub plugin.

@vinsidious
Copy link
Contributor Author

@webpro I actually went back and forth with that decision. I think my rationale was: if the execution environment was within a GitHub Action, that's on the global level and sort of pervades every other action/plugin.

That being said, you obviously have way more context here and I also agree with you. I'll make the change 👍

@webpro
Copy link
Collaborator

webpro commented Mar 18, 2020

Makes total sense. But I think e.g. the npm plugin is not interested in this. If this ever changes we can of course move it up again.

@vinsidious
Copy link
Contributor Author

@webpro Hopefully this is what you had in mind? Please let me know if this isn't the right approach

lib/plugin/github/GitHub.js Outdated Show resolved Hide resolved
@vinsidious
Copy link
Contributor Author

@webpro Looks like the tests are passing but I do want to call out that I've noticed them being a little iffy. I imagine it has something to do with ava's concurrency but appending .serial to the suspect test cases didn't seem to help very much.

@webpro
Copy link
Collaborator

webpro commented Mar 18, 2020

@vinsidious Do you recall what kind of errors you were seeing? I'm on macOS, so if you're using something different this might be useful info.

@vinsidious
Copy link
Contributor Author

I'm on macOS as well, but the logs from the failed tests on GitHub are the same as the errors I was getting locally. I was able to consistently repro by commenting/uncommenting the line that sets process.env.GITHUB_ACTION = 'foo-123'

@webpro webpro merged commit b6dc6ff into release-it:master Mar 19, 2020
@webpro
Copy link
Collaborator

webpro commented Mar 19, 2020

Thanks a lot, @vinsidious! Merged and released as v13.2.0-beta.0.

webpro pushed a commit that referenced this pull request Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub Actions - Could not authenticate with GitHub using environment variable "GITHUB_TOKEN"
2 participants