github-action-psscriptanalyzer
github-action-psscriptanalyzer copied to clipboard
SendComments Fails when from a Forked Repo, even after setting 'Send write tokens to workflows from fork pull requests.'
I get the failure
Invoke-RestMethod: /entrypoint.ps1:61 Line | 61 | Invoke-RestMethod @params > $null | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | {"message":"Resource not accessible by | integration","documentation_url":"https://docs.github.com/rest/reference/issues#create-an-issue-comment"}
when attempting to let this lint a PR from a forked repo. I have tried following articles telling me to turn on 'Send write tokens to workflows from fork pull requests' for the organization (which I assume the repos inside it would inherit), however within the org repo there isn't an individual setting for the repo to turn this on (it is at the org level only). Trying to figure out if I'm missing something in the XAML to ensure it uses the appropriate secrets token.
I just saw #2 that is closed, however it appears that the GitHub actions setting SHOULD forward the write permission to the workflow... https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/ This was added in Aug 2020
Alternatively, Is there a way to have it "Sendcomments: true" on a non-fork and Sendcomments:False on a forked repo?
Hi,
You need to add to have 2 workflows and use on: [pull_request] for make the difference