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

Resource not accessible by integration when using from fork PRs #31

Open
rchiodo opened this issue Oct 9, 2020 · 10 comments
Open

Resource not accessible by integration when using from fork PRs #31

rchiodo opened this issue Oct 9, 2020 · 10 comments

Comments

@rchiodo
Copy link

rchiodo commented Oct 9, 2020

Getting this error here when this action runs from a PR from a fork:

Posting status 'completed' with conclusion 'failure' to https://github.com/microsoft/vscode-python/pull/14326 (sha: f4e60b0f743a056b5bfdfe4c85388eeff145b22e)
Error: Resource not accessible by integration

I believe that's because of this:
https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token

Fork PRs don't get write access.

Is there a way to get the report to work without requiring write access?

@jmisur
Copy link
Contributor

jmisur commented Oct 15, 2020

Hi @rchiodo, I don't know, but I know people have problems with forks/PRs and GitHub actions in general. Please let me know when you find out and something needs to be fixed in this repo.

@rchiodo
Copy link
Author

rchiodo commented Oct 15, 2020

Thanks. Other junit reporters seem to have the same problem. This may be the way to fix it?
shyim/junit-report-annotations-action#3

@slawekjaranowski
Copy link

@devinrsmith
Copy link

This may be solvable using the workflow_run event trigger. There is an example here.

Unfortunately, it requires a bunch of extra action configuration.

action-surefire-report very important for our dev workflow though, so I'm going to be working up a solution soon - I'll make sure to link back to here for context.

@devinrsmith
Copy link

For reference, deephaven/deephaven-core#547

@jamie-wearsafe
Copy link

@jmisur can you use pull_request_target instead of pull_request?

@jmisur
Copy link
Contributor

jmisur commented Jul 15, 2021

@jmisur can you use pull_request_target instead of pull_request?

Definitely not as it's not secure https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

I might however tinker with workflow_run style, but it's super unfortunate that such hacks are necessary.

@huehnerlady
Copy link

huehnerlady commented Nov 12, 2021

Is there any update on this?I mean it has been open a while now...

Since using dependabot more and more we run into this problem more and more :(

@huehnerlady
Copy link

It seems you can add permissions to the workflow, I got the build to work again once I added the following to the job:

    permissions:
      checks: write
      contents: read
      issues: read
      pull-requests: write

see also here

ronnypolley added a commit to ronnypolley/ecliseignorehelper that referenced this issue Nov 6, 2022
ronnypolley added a commit to ronnypolley/ecliseignorehelper that referenced this issue Nov 6, 2022
* Bump plexus-utils from 3.4.2 to 3.5.0

Bumps [plexus-utils](https://github.com/codehaus-plexus/plexus-utils) from 3.4.2 to 3.5.0.
- [Release notes](https://github.com/codehaus-plexus/plexus-utils/releases)
- [Commits](codehaus-plexus/plexus-utils@plexus-utils-3.4.2...plexus-utils-3.5.0)

---
updated-dependencies:
- dependency-name: org.codehaus.plexus:plexus-utils
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* added permission to write to PRs

* also permit write to statuses

* use permissions as found in an issue

ScaCap/action-surefire-report#31 (comment)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ronny Polley <ronnypolley@googlemail.com>
joschi pushed a commit to dropwizard/dropwizard that referenced this issue Sep 26, 2023
See ScaCap/action-surefire-report#31

Pull requests from forked repositories currently have token permission issues and the Java CI checks fail. This prevents auto-merging. Pull requests from the dropwizard-repo itself have the following permissions:

```
Actions: write
Checks: write
Contents: write
Deployments: write
Discussions: write
Issues: write
Metadata: read
Packages: write
Pages: write
PullRequests: write
RepositoryProjects: write
SecurityEvents: write
Statuses: write
```
while pull requests from forked repos have the following permissions:
```
Actions: read
Checks: read
Contents: read
Deployments: read
Discussions: read
Issues: read
Metadata: read
Packages: read
Pages: read
PullRequests: read
RepositoryProjects: read
SecurityEvents: read
Statuses: read
```
zUniQueX added a commit to zUniQueX/dropwizard that referenced this issue Oct 18, 2023
See ScaCap/action-surefire-report#31

Pull requests from forked repositories currently have token permission issues and the Java CI checks fail. This prevents auto-merging. Pull requests from the dropwizard-repo itself have the following permissions:

```
Actions: write
Checks: write
Contents: write
Deployments: write
Discussions: write
Issues: write
Metadata: read
Packages: write
Pages: write
PullRequests: write
RepositoryProjects: write
SecurityEvents: write
Statuses: write
```
while pull requests from forked repos have the following permissions:
```
Actions: read
Checks: read
Contents: read
Deployments: read
Discussions: read
Issues: read
Metadata: read
Packages: read
Pages: read
PullRequests: read
RepositoryProjects: read
SecurityEvents: read
Statuses: read
```

Refs dropwizard#7586
(cherry picked from commit cb47931)
zUniQueX added a commit to zUniQueX/dropwizard that referenced this issue Oct 18, 2023
See ScaCap/action-surefire-report#31

Pull requests from forked repositories currently have token permission issues and the Java CI checks fail. This prevents auto-merging. Pull requests from the dropwizard-repo itself have the following permissions:

```
Actions: write
Checks: write
Contents: write
Deployments: write
Discussions: write
Issues: write
Metadata: read
Packages: write
Pages: write
PullRequests: write
RepositoryProjects: write
SecurityEvents: write
Statuses: write
```
while pull requests from forked repos have the following permissions:
```
Actions: read
Checks: read
Contents: read
Deployments: read
Discussions: read
Issues: read
Metadata: read
Packages: read
Pages: read
PullRequests: read
RepositoryProjects: read
SecurityEvents: read
Statuses: read
```

Refs dropwizard#7586
(cherry picked from commit cb47931)
zUniQueX added a commit to dropwizard/dropwizard that referenced this issue Oct 18, 2023
* Fix token permissions for PRs from forks

See ScaCap/action-surefire-report#31

Pull requests from forked repositories currently have token permission issues and the Java CI checks fail. This prevents auto-merging. Pull requests from the dropwizard-repo itself have the following permissions:

```
Actions: write
Checks: write
Contents: write
Deployments: write
Discussions: write
Issues: write
Metadata: read
Packages: write
Pages: write
PullRequests: write
RepositoryProjects: write
SecurityEvents: write
Statuses: write
```
while pull requests from forked repos have the following permissions:
```
Actions: read
Checks: read
Contents: read
Deployments: read
Discussions: read
Issues: read
Metadata: read
Packages: read
Pages: read
PullRequests: read
RepositoryProjects: read
SecurityEvents: read
Statuses: read
```

Refs #7586
(cherry picked from commit cb47931)

* Allow workflows to write to issues

Refs #7586

(cherry picked from commit bd7c22e)

---------

Co-authored-by: Jochen Schalanda <jochen@schalanda.name>
@mak-42
Copy link

mak-42 commented Nov 6, 2023

It seems you can add permissions to the workflow, I got the build to work again once I added the following to the job:

I tried to add write permission to the workflow for everything, but it does not help. Could you please prompt me what I am doing wrong?
My workflow: https://github.com/mak-42/action-surefire-report-bug1/blob/master/.github/workflows/maven.yml
It works locally well, but failed when running a pull request from a fork: https://github.com/mak-42/action-surefire-report-bug1/actions/runs/6768710772/job/18399735881?pr=3#logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants