Skip to content

Allow for PR coming from forks to have a Breakage comment #100

@MaxenceGollier

Description

@MaxenceGollier

Related: JuliaSmoothOptimizers/LDLFactorizations.jl#137 (comment)
Currently,

- name: PR comment with file
uses: thollander/actions-comment-pull-request@v2
with:
filePath: breakage/summary.md

always fails if the PR is coming from a fork

For example, in thollander/actions-comment-pull-request

Note that, if the PR comes from a fork, it will have only read permission despite the permissions given in the action for the pull_request event.
In this case, you may use the pull_request_target event. With this event, permissions can be given without issue (the difference is that it will execute the action from the target branch and not from the origin PR).

The thing is that using GitHub recommends to use pull_request_target very carefully: https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/

From the latter blog post, we'd need to create an additional workflow, using the pull_request_target to `write a comment in the PR coming from a fork.
I will try to write one for this repo, perhaps it could be general enough to be moved to https://github.com/JuliaSmoothOptimizers/.github afterwards ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions