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

Error: Resource not accessible by integration #64

Open
prem-prakash opened this issue Jun 2, 2024 · 8 comments
Open

Error: Resource not accessible by integration #64

prem-prakash opened this issue Jun 2, 2024 · 8 comments

Comments

@prem-prakash
Copy link

prem-prakash commented Jun 2, 2024

      - name: Generate Coverage Report
        uses: clearlyip/code-coverage-report-action@v5
        with:
          filename: 'coverage/coverage.xml'
          fail_on_negative_difference: true
          artifact_download_workflow_names: 'Lint and Test'
          only_list_changed_files: true

I get

Run clearlyip/code-coverage-report-action@v5
  with:
    filename: coverage/coverage.xml
    fail_on_negative_difference: true
    artifact_download_workflow_names: Lint and Test
    only_list_changed_files: true
    github_token: ***
    markdown_filename: code-coverage-results
    badge: false
    overall_coverage_fail_threshold: 0
    file_coverage_error_min: 50
    file_coverage_warning_max: 75
    artifact_name: coverage-%name%
    negative_difference_by: package
    negative_difference_threshold: 0
(https://github.com/***/***/actions/runs/****/job/*****#step:7:3)40558746-1
Looking for artifact "coverage-main" in the following workflows: Lint and Test
Error: Resource not accessible by integration - https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository

Is there any special permission for this?

I am pretty sure there is the artifact "coverage-main" in the workflow "Lint and Test".

I tried:

permissions: read-all

and

permissions:
  pull-requests: write
  actions: read
  contents: read
@tm1000
Copy link
Member

tm1000 commented Jun 2, 2024

You can see how it works just by looking at this repo which itself uses this

@prem-prakash
Copy link
Author

It is working, but it only works for main branch. PRs are not working.
I think the GITHUB_TOKEN does not have access to the list workflow runs, and it appears that it is only possible using a github app token or a PAT.

@tm1000
Copy link
Member

tm1000 commented Jun 2, 2024

You can look at the prs in this repo as well. Works on them. You can also see other repos that use this as well for their PRs

I don't use PAT in any of my private repos. Nor do the public repos that use this. GitHub token works well

Maybe this might help: #50

@tm1000
Copy link
Member

tm1000 commented Jun 2, 2024

External example: cfug/dio#2230

@prem-prakash
Copy link
Author

As my test procedures are really big and involves many related subsystems it is not worth having one extra cron workflow.

So I would prefer to keep just one, as the test suite also runs for merges and pushes in the main branch.

It looks like the behaviour changes depending on the input value of artifact_download_workflow_names, so I changed it to only have a value in a pull request event.

artifact_download_workflow_names: ${{ github.event_name == 'pull_request' && 'Lint and Test' || null}}

Does it make sense?

Still no success with this try.

@prem-prakash
Copy link
Author

Screenshot 2024-06-02 at 17 58 48

For anyone struggling with this, without this permission set things will not work properly.

@tm1000 tm1000 reopened this Jun 2, 2024
@tm1000
Copy link
Member

tm1000 commented Jun 2, 2024

@prem-prakash

Hey there. Great to hear! I'm going to keep it open to remember to put this into the documentation for others!

@AlexV525
Copy link

AlexV525 commented Jun 3, 2024

External example: cfug/dio#2230

We already have that write permission granted, if it helps
image

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

3 participants