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

Make GITHUB_TOKEN an action input #271

Open
plbstl opened this issue Jun 28, 2024 · 0 comments
Open

Make GITHUB_TOKEN an action input #271

plbstl opened this issue Jun 28, 2024 · 0 comments

Comments

@plbstl
Copy link

plbstl commented Jun 28, 2024

It's a nuance, but there shouldn't be a need to input GITHUB_TOKEN if it can be avoided.

It may also help resolve #232.

An example implementation:

# action.yml
inputs:
  githubToken:
      description: "The GitHub access token (e.g. secrets.GITHUB_TOKEN) used to ... This defaults to {{ github.token }}."
      default: "${{ github.token }}"
      required: false
// src/index.js
const githubToken = core.getInput("githubToken", {required: true})

// OR

// src/parseConfig.js
let githubToken;
if (process.env.INPUT_GITHUBTOKEN) {
  githubToken = ConfigParser.parseString(process.env.INPUT_GITHUBTOKEN)
}
// src/index.js
const client = github.getOctokit(githubToken, {
    baseUrl: githubBaseUrl
});
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

No branches or pull requests

1 participant