How to setup github [Pull Request Labeler](https://github.com/actions/labeler)

Pull Request Labeler action showing error

Error: Error: Input required and not supplied: repo-token
Error: Input required and not supplied: repo-token

secrets name is LABEL
I have add secrets name in secrets of origination.
what wrong any one please help me

It’s hard to say for sure without seeing your workflow, but the message sounds like there’s no repo-token when you call the action. The documentation gives this example:

    - uses: actions/labeler@main
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

So if you want to use a secret named LABEL, you’d have to do this:

    - uses: actions/labeler@main
      with:
        repo-token: "${{ secrets.LABEL }}"

That LABEL would have to be a PAT with appropriate rights, though in most cases the GITHUB_TOKEN should work.

1 Like

here is https://github.com/letskhabar/pr-try Github repo link and https://github.com/letskhabar/pr-try/tree/master/.github/workflows is workflow link

thanks

Ah, I see the problem. A workflow that’s triggered by a pull_request event from a fork won’t be able to access secrets other than the GITHUB_TOKEN, see Using encrypted secrets in a workflow.

The first thing I’d try it to check if it works with GITHUB_TOKEN. If not and you really need a PAT you could use the pull_request_target event instead of pull_request.

1 Like

when I am adding GITHUB_TOKEN secret, it show me a error

Failed to add secret. Name is invalid

You don’t need to create the GITHUB_TOKEN. Github provides it automatically when a workflow is started, I assume that’s why the name isn’t available for your own secret. You just have to use the token, see Authentication in a workflow. That page actually has an example using actions/labeler, maybe that’ll work for you?

Edit: That page also explicitly states that the GITHUB_TOKEN created for a pull_request event from a fork will only be able to read issues. I assume that’s why the example in the actions/labeler Readme also uses pull_request_target.

1 Like