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

HttpError: Resource not accessible by integration #8

Closed FogDong closed 2 years ago

FogDong commented 2 years ago

If the pull request is coming from a fork, it may trigger the error HttpError: Resource not accessible by integration when attempting to add a label.

May same to the error: actions/labeler#12

thehanimo commented 2 years ago

Hi @FogDong! That's very interesting. I think the solution involves using pull_request_target instead of pull_request. Might need changes to be made in the action as well. I will take a look at this and post an update here. Thanks!

thehanimo commented 2 years ago

Found the fix @FogDong! Replacing pull_request with pull_request_target as the event trigger does it. Had to make a minor fix to read issue_number properly. Updated README and released v1.3.2!

Make sure your yaml file looks something like this now:

name: "PR Title Checker"
on:
  pull_request_target:
    types:
      - opened
      - edited
      - synchronize
      - labeled
      - unlabeled

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: thehanimo/pr-title-checker@v1.3.2
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          pass_on_octokit_error: false
          configuration_path: ".github/pr-title-checker-config.json"

pull_request is now pull_request_target and version should be v1.3.2. Hope this helps!

rakesh4145 commented 2 years ago

how to check title like :-- i had made changes with JIRA ticket now i want to match string if JIRA exist in PR Title. please suggest me regex for that

thehanimo commented 2 years ago

Assuming you just want to check if JIRA exists anywhere in the PR title, use: "JIRA"