Skip to content

claim bot: on a fork PR the label and the explanation fail with HTTP 403, so the author never sees why the check failed #34

Done

Description

@vpacher

Problem

On a pull request from a fork, the claim bot cannot write. The pull_request event from a fork gets a read-only GITHUB_TOKEN, even though the caller job in obs-rust/obs-studio asks for issues: write and pull-requests: write. When the bot finds a claim conflict, it cannot add the label and cannot post its explanation:

obs-rust/obs-studio#5547: label_add 'claim-conflict'
##[warning]obs-rust/obs-studio#5547: label_add failed: gh kept failing: POST repos/obs-rust/obs-studio/issues/5547/labels -> HTTP 403: gh: Resource not accessible by integration (HTTP 403)
##[warning]obs-rust/obs-studio#5547: comment failed: gh kept failing: POST repos/obs-rust/obs-studio/issues/5547/comments -> HTTP 403: gh: Resource not accessible by integration (HTTP 403)

(Claim bot runs 45288247847 and 45288308289 on obs-rust/obs-studio#5547, 2026-11-24.)

The check goes red, but the author does not see why. On #5547 the cause was that the hourly sweep had unassigned the author from obs-rust/obs-studio#5134 after 24 hours without progress. Only a maintainer who read the job log could find this. A maintainer /reassign and a rerun of the bot fixed it.

Expected

A fork contributor sees why the claim check failed and what to do (for example, "comment Claiming: #5134 on the issue"), without help from a maintainer.

Possible fixes

  1. Write the explanation to the job step summary ($GITHUB_STEP_SUMMARY) and as an error annotation when a write returns HTTP 403. The author can read it from the failed check. This needs no new token scope.
  2. Run the PR check for forks from a pull_request_target caller, which gets a write token. The bot must then never check out or run code from the PR head.
  3. Leave the label and comment to the hourly sweep (schedule event, write token), and make the PR check only report.

Option 1 is the smallest change and is safe. Option 2 or 3 also gets the label and the comment onto the PR.

Found while acting as coordinator on obs-rust/obs-studio#5547.

Activity

  1. vpacher commented on Nov 25, 2026

    @vpacher
    MemberAuthor

    Claiming: #34

    Plan (one PR):

    1. RED: a test in tests/ where the PR check's label or comment write returns HTTP 403 and expects the explanation in the step summary and as an ::error:: annotation.
    2. GREEN: claim_bot.py writes the explanation it could not post to $GITHUB_STEP_SUMMARY and as an error annotation (option 1 of the issue). No new token scope.

    First PR expected today.

  2. added
    ready
    on Nov 25, 2026
  3. added a commit that references this issue on Nov 25, 2026
    44e70bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions