auto-assign-action
auto-assign-action copied to clipboard
Keep getting Bad_Credentials error
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
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?
@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
@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.
https://github.com/actions/toolkit/pull/453
I had worked on this before but never completed it.
https://github.com/kentaro-m/auto-assign-action/pull/63
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.
@kentaro-m my team was able to test the new version with GHE Server successfully 💯
@kentaro-m Unfortunately it still doesn't work with GHE 😢