Using GITHUB_TOKEN as a default input value
07 Oct 2022 in TIL
If you need to authenticate against the GitHub API in your GitHub Action, you might prompt the user to provide their GITHUB_TOKEN secret through an input. This isn't necessarily needed thanks to the github.token context and default input values.
You can gain access to the GITHUB_TOKEN secret by default by configuring your action.yml file to access github.token:
yamlname: Action Namedescription: My awesome description goes hereruns:using: node12main: dist/index.jsinputs:token:description: The GitHub token to use when calling the APIdefault: ${{ github.token }}required: false