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

"repo-token lacks required permissions" #102

Open
thangeshbabu opened this issue Mar 7, 2024 · 3 comments
Open

"repo-token lacks required permissions" #102

thangeshbabu opened this issue Mar 7, 2024 · 3 comments

Comments

@thangeshbabu
Copy link

thangeshbabu commented Mar 7, 2024

I am trying to use this action in Github Enterprise using Self Hosted Runner.
No matter what permission I assign, job keeps failing with error "repo-token lacks required permissions"

Debug Log - Permissions :

##[group]GITHUB_TOKEN Permissions
2024-03-07T15:40:25.2941943Z Actions: write
2024-03-07T15:40:25.2942376Z Checks: write
2024-03-07T15:40:25.2942842Z Contents: write
2024-03-07T15:40:25.2943416Z Deployments: write
2024-03-07T15:40:25.2943860Z Discussions: write
2024-03-07T15:40:25.2944383Z Issues: write
2024-03-07T15:40:25.2944841Z Metadata: read
2024-03-07T15:40:25.2945333Z Packages: write
2024-03-07T15:40:25.2946107Z Pages: write
2024-03-07T15:40:25.2946601Z PullRequests: write
2024-03-07T15:40:25.2947416Z RepositoryProjects: write
2024-03-07T15:40:25.2947944Z SecurityEvents: write
2024-03-07T15:40:25.2948453Z Statuses: write

my github workflow yaml:

on: pull_request
permissions: write-all
jobs:
  find-flags:
    runs-on: self-hosted
    name: Find LaunchDarkly feature flags in diff
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Find flags
        uses: launchdarkly/[email protected]
        id: find-flags
        with:
          project-key: <project-key>
          environment-key: dev
          access-token: ${{ secrets.LD_ACCESS_TOKEN }}
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          create-flag-links: true
      - name: Add label
        if: steps.find-flags.outputs.any-changed == 'true'
        run: gh pr edit $PR_NUMBER --add-label ld-flags
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PR_NUMBER: ${{ github.event.pull_request.number }}
      - name: Remove label
        if: steps.find-flags.outputs.any-changed == 'false'
        run: gh pr edit $PR_NUMBER --remove-label ld-flags
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PR_NUMBER: ${{ github.event.pull_request.number }}
@jazanne
Copy link
Contributor

jazanne commented Mar 19, 2024

@thangeshbabu Sorry you're seeing issues with the action. Can you share more information about which step(s) are failing with the repo token permissions error?

@thangeshbabu
Copy link
Author

@jazanne thanks for responding,
It is failing on "Find Flags" Step and below is the SS of error I am facing.
image

@jazanne
Copy link
Contributor

jazanne commented Mar 28, 2024

@thangeshbabu Since you are an enterprise account, can you check that your organizations permission settings are correct? I'm unable to reproduce this issue

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

2 participants