Closed gustavkj closed 1 year ago
I reproduced this issue in #437 - as far as I can tell #429 isn't what broke this as I was able to reproduce the issue with base-url
fully removed - https://github.com/actions/github-script/pull/437/commits/98dabfb42fa1f4bcaf07ebc5f0d1bb8d743a0486
I suspect something might have broken upstream in @actions/github
or Octokit when they were updated in #425.
The plot thickens. Just to try something else, if base-url
was to default to ${{ github.api_url }}
(or ${{ env.GITHUB_API_URL }}
) does it work again then?
The plot thickens. Just to try something else, if
base-url
was to default to${{ github.api_url }}
(or${{ env.GITHUB_API_URL }}
) does it work again then?
That doesn't work either, though it's possible my integration test is flawed.
I tried out my thesis on the Github Enterprise Server instance now, it worked! So, it seems that defaulting base-url
to ${{ github.api_url }}
should work. 🤔
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
base-url: ${{ github.api_url }}
script: |
const { data: pr } = await github.rest.issues.get({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
@gustavkj could you see if this works on your GHES instance?
- uses: actions/github-script@joshmgross/fix-base-url
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
});
That's the branch from https://github.com/actions/github-script/pull/437
could you see if this works on your GHES instance?
I don't have the latest commit (the GHES instance synced the actions from Github.com last night, so the last commit is 85717e4e3b7e735dc65aff3d600d5a740976d639), it went green but it has other changes.
I tried also also going back and ran pinned to commit sha 28e431842a5f80e8b5f22c48445cb63472acd898, which I think is the same as the latest commit. And it worked as well!
Given that there is a way to force the workflow to go towards the action on Github.com instead of the one synced to the GHES instance, I can give that a try. But I'm not aware of any workaround. Do you know?
Otherwise, as I said, I think 28e431842a5f80e8b5f22c48445cb63472acd898 is the same as the latest commit, right?
28e431842a5f80e8b5f22c48445cb63472acd898 is the same, that's right. Thanks for verifying it works, looks like my integration test doesn't actually cover this case.
But I'm not aware of any workaround. Do you know?
Not if you have a local version of the same action, no.
Should be fixed in https://github.com/actions/github-script/releases/tag/v7.0.1 and v7
has been updated to match that tag.
Thank you for fixing it so fast! I'll try it out when I'm back at work on Monday. Thanks again! 🌟
Hi again! I can confirm that it works now. 🌟 Thanks once more!
Describe the bug After upgrading to
v7
requests in workflows on Github Enterprise are sent toapi.github.com
instead of using theGITHUB_API_URL
environment variable.Seems like that https://github.com/actions/github-script/pull/429 broke the default behavior of
@actions/github
:https://github.com/actions/toolkit/blob/20f826bfe76164099ab2403d9ea8509e16843223/packages/github/src/internal/utils.ts#L42-L44
To Reproduce Steps to reproduce the behavior:
v7
, but run the same thing:api.github.com
:Expected behavior It should still use the
GITHUB_API_URL
environment variable, and not require extra configuration to work on Github Enterprise