thehanimo / pr-title-checker

An action to automatically check if pull request titles conform to Contribution Guidelines
MIT License
106 stars 36 forks source link

GITHUB_TOKEN variable is not set #4

Closed bennycode closed 3 years ago

bennycode commented 3 years ago

I know that the "pr-title-checker" needs the GitHub token in order to add labels to a PR when the PR title doesn't match the pattern but is the token needed for something else too? Because it would be nice if you wouldn't have to give it a token.

In our CI setup we sometimes have the problem that the context for the token is unavailable and then our ci fails with the error message "GITHUB_TOKEN variable is not set". I am fine with not having a label but I don't want that the build then fails.

thehanimo commented 3 years ago

You're right! Apart from creating labels, the action needs GitHub tokens to add labels to PRs, remove them from PRs and to fetch the config file from the repository. So the action is pretty much useless without a token.

However, since you mentioned that your CI setup sometimes has a different context, I feel that passing/failing the action should be controllable by the user. I've just released v1.3 with a pass_on_octokit_error that you can set to true to avoid the issue you're facing. Your yaml file should look something like this:

      - uses: thehanimo/pr-title-checker@v1.3
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          pass_on_octokit_error: true

Hope this helps!

thehanimo commented 3 years ago

@bennycode closing this for now. Feel free to re-open in case you need any help!

bennycode commented 3 years ago

Thank you very much for you input. I applied your suggested changes to my repository: https://github.com/wireapp/wire-webapp/pull/11849