thehanimo / pr-title-checker

An action to automatically check if pull request titles conform to Contribution Guidelines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GITHUB_TOKEN variable is not set

bennycode opened this issue · comments

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.

commented

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!

commented

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

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