-
Notifications
You must be signed in to change notification settings - Fork 469
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
After upgrading to v7
requests in workflows on Github Enterprise are sent to api.github.com
instead of using the GITHUB_API_URL
environment variable.
Seems like that #429 broke the default behavior of @actions/github
:
export function getApiBaseUrl(): string {
return process.env['GITHUB_API_URL'] || 'https://api.github.com'
}
To Reproduce
Steps to reproduce the behavior:
- On Github Enterprise run:
- uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { data: pr } = await github.rest.issues.get({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo });
- It should work
- Upgrade to
v7
, but run the same thing:- uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { data: pr } = await github.rest.issues.get({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo });
- It will fail due to sending request to
api.github.com
:
equestError [HttpError]: Not Found
at /opt/actions-runner/_work/_actions/actions/github-script/e69ef5462fd455e02edcaf4dd7708eda96b9eda0/dist/index.js:9537:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async eval (eval at callAsyncFunction (/opt/actions-runner/_work/_actions/actions/github-script/e69ef5462fd455e02edcaf4dd7708eda96b9eda0/dist/index.js:35424:16), <anonymous>:4:22)
at async main (/opt/actions-runner/_work/_actions/actions/github-script/e69ef5462fd455e02edcaf4dd7708eda96b9eda0/dist/index.js:35518:20) {
status: 404,
response: {
url: 'https://api.github.com/repos/org/repo/issues/194',
status: 404,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
'content-encoding': 'gzip',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 16 Nov 2023 11:14:15 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
'transfer-encoding': 'chunked',
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-accepted-oauth-scopes': 'repo',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-api-version-selected': '2022-11-28',
'x-github-media-type': 'github.v3; format=json',
'x-github-request-id': '1682:BD33:17EF531:183D562:6555F973',
'x-oauth-scopes': '',
'x-ratelimit-limit': '5000',
'x-ratelimit-remaining': '4224',
'x-ratelimit-reset': '1700134314',
'x-ratelimit-resource': 'core',
'x-ratelimit-used': '776',
'x-xss-protection': '0'
},
data: {
message: 'Not Found',
documentation_url: 'https://docs.github.com/rest/issues/issues#get-an-issue'
}
},
request: {
method: 'GET',
url: 'https://api.github.com/repos/org/repo/issues/194',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'actions/github-script octokit-core.js/5.0.1 Node.js/20.8.1 (linux; x64)',
authorization: 'token [REDACTED]'
},
request: {
agent: [Agent],
fetch: [Function: proxyFetch],
hook: [Function: bound bound register]
}
}
}
Expected behavior
It should still use the GITHUB_API_URL
environment variable, and not require extra configuration to work on Github Enterprise
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working