Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(github-bot): handle pull_request_review event from fork #3319

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aeddi
Copy link
Contributor

@aeddi aeddi commented Dec 10, 2024

This PR fixes this issue: #3238 (comment)

In summary, the pull_request_review event, when emitted from a PR opened from a fork, only allows the GitHub Bot workflow to run with read-only permissions.

This PR addresses this issue by:

  • Ensuring that the GitHub Bot workflow does not fail in the case of a read-only run, but simply saves the number of the PR to be processed by uploading a file containing the number as an artifact (which is possible even in read-only mode).
  • Adding a new GitHub Bot Proxy workflow that monitors all completed runs of the GitHub Bot through a subscription to the workflow_run event.
  • If a run of the GitHub Bot workflow concerns a pull_request_review event, the GitHub Bot Proxy workflow retrieves the artifact containing the PR number and then re-runs the GitHub Bot workflow using a workflow_dispatch event.
  • The GitHub Bot workflow then runs again, but this time with write permissions, allowing it to update its comment or the status of its CI check, among other things.

@Gno2D2
Copy link
Collaborator

Gno2D2 commented Dec 10, 2024

🛠 PR Checks Summary

🔴 The pull request head branch must be up-to-date with its base (more info)

Manual Checks (for Reviewers):
  • SKIP: Do not block the CI for this PR
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)
🔴 The pull request head branch must be up-to-date with its base (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 The pull request was created from a fork (head branch repo: aeddi/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

The pull request head branch must be up-to-date with its base (more info)

If

🟢 Condition met
└── 🟢 On every pull request

Then

🔴 Requirement not satisfied
└── 🔴 Head branch (aeddi:dev/aeddi/bot-fix-review) is up to date with base (master): behind by 2 / ahead by 2

Manual Checks
**SKIP**: Do not block the CI for this PR

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@aeddi aeddi force-pushed the dev/aeddi/bot-fix-review branch from c09bcd4 to c53282b Compare December 10, 2024 17:11
.github/workflows/bot.yml Outdated Show resolved Hide resolved
Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hacky, but LGTM.

summoning the action masters @ajnavarro @sw360cab for a second review

@Kouteki Kouteki added the in focus Core team is prioritizing this work label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in focus Core team is prioritizing this work
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

4 participants