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

Set default token for simpler setup #83

Merged
merged 3 commits into from
Jul 26, 2021

Conversation

alerque
Copy link
Contributor

@alerque alerque commented Mar 16, 2021

99 times out of 100 people won't need anything other than the default token already available in scope, defaulting to it saves everybody YAML setup mess.

@softprops
Copy link
Owner

Do actions inherit this env variable without explicitly declaring it? If so I'm good to merge this

@alerque
Copy link
Contributor Author

alerque commented Mar 21, 2021

@softprops It isn't an ENV variable. The system you were using is an ENV variable, and no those to not propagate without explicitly declaring them to be passed to an Action. What I'm doing here combines two other things: input fields which can have default values with context scoped variables, which I believe are available by default in the scope used here.

I copied this arrangement from another Action that I saw using it and found it convenient, but I guess it does bear testing out to make sure there wasn't some other kind of scope magic or authorization that I missed.

@alerque
Copy link
Contributor Author

alerque commented Mar 21, 2021

Here is an example on an Action that uses this arrangement: https://github.com/peter-evans/create-pull-request/blob/master/action.yml#L4-L6

@alerque
Copy link
Contributor Author

alerque commented Mar 21, 2021

@softprops I just fixed the merge conflicts, but it looks like the handling of process.env.GITHUB_REPOSITORY vs. getInput('repostiory') is all scrambled. It looks like it was partially implemented as an input, and now it is regressed to being only an env var. Is there some reason this can't be an optional input with a normal default value? I don't see the advantage of using an env variable here and the fallback mechanism for two env vars makes it even more confusing.

@yin1999
Copy link
Contributor

yin1999 commented Mar 21, 2021

I think this is a better way to get access token.
This method is also used by the official action

When using inputs to get the access token, it's default to ${{ github.token }}

official example here

@softprops
Copy link
Owner

The repository input was likely an effect of #61

@alerque
Copy link
Contributor Author

alerque commented Mar 22, 2021

Yes that's where it should have come from, but it does not seem to have been implemented properly. If it was, the current documentation is surely wrong. In 94651eb the documentation was updated to reflect something different than how it should have been implemented, and honestly I can't quite make out whether it ever worked the way it was supposed to or why the documentation was changed.

Where do the env.INPUT_* values even get set? The GitHub Actions API for this should be getInput() or some such, but don't see where that's being used. I see the @actions/core and @actions/github libraries but neither of those document this kind of config handling.

@softprops
Copy link
Owner

going to cut a release with current changes in then merge this into the following.

@softprops softprops merged commit 05d11c9 into softprops:master Jul 26, 2021
@alerque alerque deleted the default-token branch July 27, 2021 08:07
alerque added a commit to alerque/vcsh that referenced this pull request Jul 27, 2021
alerque added a commit to RichiH/vcsh that referenced this pull request Jul 27, 2021
alerque added a commit to alerque/git-warp-time that referenced this pull request Jul 27, 2021
alerque added a commit to sile-typesetter/casile that referenced this pull request Jul 27, 2021
alerque added a commit to sile-typesetter/sile that referenced this pull request Jul 27, 2021
alerque added a commit to alerque/starship that referenced this pull request Jul 27, 2021
alerque added a commit to theleagueof/fontship that referenced this pull request Jul 27, 2021
alerque added a commit to theleagueof/league-gothic that referenced this pull request Jul 27, 2021
alerque added a commit to theleagueof/league-mono that referenced this pull request Jul 27, 2021
alerque added a commit to theleagueof/league-spartan that referenced this pull request Jul 27, 2021
alerque added a commit to theleagueof/ostrich-sans that referenced this pull request Jul 27, 2021
alerque added a commit to theleagueof/raleway that referenced this pull request Jul 27, 2021
alerque added a commit to theleagueof/the-neue-black that referenced this pull request Jul 27, 2021
matchai pushed a commit to starship/starship that referenced this pull request Jul 27, 2021
dyt811 pushed a commit to ivadomed/ivadomed that referenced this pull request Apr 3, 2022
Now using default token automatically per PR83 from softprops/action-gh-release#83
cakester pushed a commit to ivadomed/ivadomed that referenced this pull request Apr 18, 2022
Now using default token automatically per PR83 from softprops/action-gh-release#83
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.

3 participants