Skip to content

Enable PHP change detection even from forked repositories#59780

Closed
t-hamano wants to merge 1 commit into
trunkfrom
php-changes-detection-forked-repo
Closed

Enable PHP change detection even from forked repositories#59780
t-hamano wants to merge 1 commit into
trunkfrom
php-changes-detection-forked-repo

Conversation

@t-hamano

@t-hamano t-hamano commented Mar 12, 2024

Copy link
Copy Markdown
Contributor

Fixes #59441

What?

This PR will detect changes in PHP files and leave comments even when a PR is submitted from a forked repository.

Why?

GitHub Actions shows an error like below.

Run peter-evans/create-or-update-comment@v4
/home/runner/work/_actions/peter-evans/create-or-update-comment/v4/dist/index.js:4695
      const error = new requestError.RequestError(toErrorMessage(data), status, {
                    ^

RequestError [HttpError]: Resource not accessible by integration

I think this issue is similar to #52981. If the PR is from a forked repository, I would expect GitHub Actions to fail because contributors don't have write permission.

How?

I changed the trigger from pull_request to pull_request_target. This GitHub Actions uses peter-evans/create-or-update-comment, which is also mentioned in that repository's README as follows:

Note: In public repositories this action does not work in pull_request workflows when triggered by forks. Any attempt will be met with the error, Resource not accessible by integration. This is due to token restrictions put in place by GitHub Actions. Private repositories can be configured to enable workflows from forks to run without restriction. See here for further explanation. Alternatively, use the pull_request_target event to comment on pull requests.

Testing Instructions

I believe this PR makes sense, but I don't know how to test that this PR is correct 😅

Testing Instructions for Keyboard

Screenshots or screencast

@t-hamano t-hamano added [Type] Project Management Meta-issues related to project management of Gutenberg GitHub Actions Pull requests that update GitHub Actions code labels Mar 12, 2024
@t-hamano t-hamano self-assigned this Mar 12, 2024
@t-hamano t-hamano marked this pull request as ready for review March 12, 2024 12:05
@t-hamano t-hamano requested a review from desrosj as a code owner March 12, 2024 12:05
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: t-hamano <wildworks@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano

Copy link
Copy Markdown
Contributor Author

This workflow has been removed as of #62609 and should no longer cause the issue.

@t-hamano t-hamano closed this Jun 20, 2024
@desrosj desrosj deleted the php-changes-detection-forked-repo branch June 27, 2024 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GitHub Actions Pull requests that update GitHub Actions code [Type] Project Management Meta-issues related to project management of Gutenberg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Github workflow: PHP backport changes action doesn't work in case of forked repository

1 participant