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

Bad credentials error on POST #25

Open
sjmadsen opened this issue Jun 15, 2021 · 7 comments
Open

Bad credentials error on POST #25

sjmadsen opened this issue Jun 15, 2021 · 7 comments

Comments

@sjmadsen
Copy link

I can't get the test coverage results to POST back to GitHub. Every time I get a 401 bad credentials error.

  • using v0.2.21
  • the entire job run takes less than 5 minutes
  • I'm using the default GITHUB_TOKEN
  • repository settings allow both read and write permissions for workflows
  • the job YAML is not further restricting permissions
  • self-hosted macOS runner

I could use some advice on how to continue troubleshooting this.

@HackingGate
Copy link

I have the same issue on GitHub hosted Ubuntu runner.
I fixed it by removing commenting function. Added an additional action to comment the report.
You can try my pull request #26.

@scttl
Copy link

scttl commented Aug 11, 2021

I ran into the same issue when trying to use the default token, but what fixed it for me was explicitly specifying the default token like so:
github-token: ${{ secrets.GITHUB_TOKEN }}

@natecheadle
Copy link

to clarify @scttl comment. place github-token under with: for the task. This appears to resolve the issue.

- name: Publish Code Coverage Results
        uses: romeovs/[email protected]
        with:
          lcov-file: ${{Code_Coverage_File}}
          github-token: ${{ secrets.GITHUB_TOKEN }}

tricktron added a commit to tricktron/qr-and-bar-code that referenced this issue Oct 19, 2021
@Wolven531
Copy link

Still getting a 401 by default (no vars provided) - https://github.com/Wolven531/deno-playground/actions/runs/2297608812 and a 403 when explicitly using ${{ secrets.GITHUB_TOKEN }} - https://github.com/Wolven531/deno-playground/actions/runs/2297633272

That latter of which explicitly says "Resource not accessible by integration". Not sure what to make of that

@Wolven531
Copy link

Wolven531 commented May 10, 2022

Was able to fix this by:

a) Using GitHub web UI to generate a new Personal Access Token w/ most scopes/permissions enabled (none of the admin ones)
b) Add new secret to my repository settings (Note - the secret cannot start w/ GITHUB_) called CICD_PAT w/ value from a)
c) Use the new secret in my workflow file (full code chunk below)

- name: Code Coverage Report
        uses: romeovs/[email protected]
        with:
          lcov-file: ./coverage/lcov.info
          github-token: ${{ secrets.CICD_PAT }}

GH Settings page -

image

GH Repo Secrets -

image

Successful job -

image

Comment posted -

image

@and3rson
Copy link

and3rson commented May 13, 2022

I was able to make it work with default GITHUB_TOKEN by adding pull-requests: write permission to my workflow:

# ...
permissions:
  contents: read  # Required when overriding permissions
  pull-requests: write  # <== Add this to allow action to modify your PR
# ...
jobs:
  # ...
  backend:
    # ...
    steps:
      # ...
      - uses: romeovs/[email protected]
        with:
          lcov-file: ./back-end/coverage.lcov
          github-token: ${{ secrets.GITHUB_TOKEN }}

https://docs.github.com/en/actions/security-guides/automatic-token-authentication#example-1-passing-the-github_token-as-an-input

image

@phanhuutoan
Copy link

Was able to fix this by:

a) Using GitHub web UI to generate a new Personal Access Token w/ most scopes/permissions enabled (none of the admin ones) b) Add new secret to my repository settings (Note - the secret cannot start w/ GITHUB_) called CICD_PAT w/ value from a) c) Use the new secret in my workflow file (full code chunk below)

- name: Code Coverage Report
        uses: romeovs/[email protected]
        with:
          lcov-file: ./coverage/lcov.info
          github-token: ${{ secrets.CICD_PAT }}

GH Settings page -

image

GH Repo Secrets -

image

Successful job -

image

Comment posted -

image

I do the same to use but still got Error: Resource not accessible by integration

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