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

Keep getting Bad_Credentials error #101

Open
thilakpv opened this issue Dec 1, 2022 · 6 comments
Open

Keep getting Bad_Credentials error #101

thilakpv opened this issue Dec 1, 2022 · 6 comments
Assignees

Comments

@thilakpv
Copy link

thilakpv commented Dec 1, 2022

name: On Open PR Actions

on:
pull_request:
# types: [opened]

jobs:
auto-assign:
permissions: write-all
runs-on: self-hosted
steps:
- name: Auto Assign Action
uses: kentaro-m/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

I keep getting Bad Credentials error despite of token having write permissions. What am I missing?

GITHUB_TOKEN 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
Secret source: Actions
Prepare workflow directory
Prepare all required actions

Error: Bad credentials

@ihmabreu
Copy link

I am also facing the same issue. In my case I am using the GitHub Enterprise Server 3.6.3 and the '2.293.1' runners version. Which permissions need the token to have? Any help on this?

@lette1394
Copy link

lette1394 commented Feb 13, 2023

@ihmabreu @thilakpv

Hello.
This project is set to look at the public github baseUrl by default.
Therefore, if you host and use Github Enterprise yourself, you need to modify the code as follows

// src > run.ts

export async function run() {
  try {
    const token = core.getInput('repo-token', { required: true })
    const configPath = core.getInput('configuration-path', { required: true })   
    const client = new github.GitHub(token, {
      baseUrl: "<ENTER_YOUR_GITHUB_ENTERPRISE_API_URL>",  //  ex) https://git.my-company.com/api/v3
    })

   ....
}

After modifying the code, run the following command before pushing.

npm run package

@kentaro-m
Copy link
Owner

@ihmabreu @thilakpv @lette1394

The URL of the API endpoint should normally be changed based on the environment variable (GITHUB_API_URL).

https://docs.github.com/en/actions/creating-actions/about-custom-actions#compatibility-with-github-enterprise-server

However, this action uses a library that does not support GitHub Enterprise Server and communicates with the GitHub API, so API endpoint changes based on environment variables are not available.

Perhaps updating the @actions/github package to v3 or higher will resolve this issue.

actions/toolkit#453

I had worked on this before but never completed it.

#63

@kentaro-m
Copy link
Owner

I merged #63 and released these changes as v1.2.5.
If it's possible, please try to check this action works with GHE Server.

@ihmabreu
Copy link

ihmabreu commented Mar 31, 2023

@kentaro-m my team was able to test the new version with GHE Server successfully 💯

@luanfonsecap
Copy link

@kentaro-m Unfortunately it still doesn't work with GHE 😢

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

5 participants