Skip to content

GH Actions: auto-comment on PR does not work for PRs coming from forks #42

@jrfnl

Description

@jrfnl

Introduced in #6 and updated via #40, the publish-wiki.yml currently contains the following step which is executed during PR dry-runs:

- name: "[PR only] Post comment to review artifact"
if: ${{ github.event_name == 'pull_request' }}
uses: mshick/add-pr-comment@v2
with:
repo-token: ${{ secrets.COMMENT_ON_PRS_TOKEN }}
message: |
**_=== This is an auto-generated comment ===_**
Thank you for your PR.
A dry-run has been executed on your PR, executing all markdown pre-processing for the wiki files.
Please review the resulting final markdown files via the [created artifact](${{ steps.artifact.outputs.artifact-url }}).
This is especially important when adding new pages or updating auto-generated output blocks.
_N.B.: the above link will automatically be updated when this PR is updated._

The problem is that the comment does not get added to PR coming from forks.

The action runner has a section about this in their documentation, but that would require setting up a proxy: https://github.com/mshick/add-pr-comment?tab=readme-ov-file#proxy-for-fork-based-prs

I was hoping to avoid that by using a Personal Access Token (PAT) instead of the standard GITHUB_TOKEN for repo access. Unfortunately, that didn't work.

So the problem to be solved is how to get the comment posted on PRs coming from forks.

Oh and it would be great if the posting of the comment would be done from a "robot" (like GitHub[bot]) account instead of from my personal account (which is what's currently happening due to the use of the PAT).

I'm not married to the current action runner being used, though I did do research into various action runners for this task when creating the workflow and didn't find a better one.

Either way, all options to potentially solve this are open.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions