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 #253

Open
patrickelectric opened this issue Apr 29, 2023 · 4 comments
Open

Resource not accessible by integration #253

patrickelectric opened this issue Apr 29, 2023 · 4 comments

Comments

@patrickelectric
Copy link

Subject of the issue

The action is not working

Your git environment

I have a step that is like that:

      - name: Fetch PR
        if: ${{ github.event.pull_request }}
        uses: 8BitJonny/gh-get-current-pr@2.2.0

      - name: Rebase PR with target
        if: ${{ github.event.pull_request }}
        run: |
          git rebase $GITHUB_BASE_REF
          git log $GITHUB_BASE_REF..HEAD --pretty=format:"%h - %s (%an)"

image

Expected behaviour

To fetch the current PR

Actual behaviour

It's failing

@roman-parkhunovskyi
Copy link

roman-parkhunovskyi commented May 1, 2023

Confirm.
In my workflow there are permissions defined as follows:

permissions:
  id-token: write
  contents: read

then

    steps:
      - id: PR
        uses: 8BitJonny/gh-get-current-pr@2.2.0
        with:
          sha: ${{ github.event.pull_request.head.sha }}
          # github-token: ${{ secrets.GITHUB_TOKEN }} - didn't work as well
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Neither passing GITHUB_TOKEN env nor github-token works, with the same outcome.

Update:
Seems to be working after adding another permission:

pull-requests: read

@dargmuesli
Copy link
Contributor

dargmuesli commented Oct 16, 2023

Are your repositories on which this issue occurs private by any chance?

Edit: pull-requests: read was the only permission I had to set, even on a private repository. I was able to define this permission on the specific job only without the need to set it per workflow. I also added github-token: ${{ github.token }}.

@nnamacha
Copy link

nnamacha commented Oct 1, 2024

where are you supposed to make these changes?

@dargmuesli
Copy link
Contributor

jobs:
  <job_name>:
    permissions:
      pull-requests: read

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

4 participants