-
-
Notifications
You must be signed in to change notification settings - Fork 439
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
Having issues creating PR on a server that is not github.com #2020
Comments
Hi @mattinger I think the issue is the trailing env:
GITHUB_SERVER_URL: https://github.xxxxx.com If this is the problem then I'll add a fix to remove trailing slashes. |
I double checked, and we are not using a trailing slash:
I will try directly setting the environment variable on the |
Even with the env set directly, it is still failing with the same error:
Note that there's no / at the end of the env variable. |
I'm guessing maybe this is a scoping issue @peter-evans ? Is |
My guess is that Are you setting the env on the action like this? If not, please try it. - name: commit-and-push-with-pr
uses: peter-evans/create-pull-request@v5
if: ${{ inputs.create-pull-request }}
env:
GITHUB_SERVER_URL: https://github.xxxxx.com
with:
token: ${{ steps.set-github-env.outputs.github_token }}
path: code
add-paths: "${{ inputs.resource-path }}/**/${{ inputs.localizable-strings-filename }} ${{ inputs.localizable-string-path }}/${{ inputs.localizable-swift-filename}}"
base: main
branch: ${{ inputs.commit-branch }}
commit-message: 'Sync ${{ github.workflow }} strings from S3'
title: 'CMS Strings update: ${{ github.workflow }}'
body: 'Sync ${{ github.workflow }} strings from S3' |
Yes i'm setting it like that, though i'm using the output from another step:
As i said, is suspect that the |
It seems indeed that using the "env" black on the action DOES NOT override GITHUB_SERVER_URL, which i assume is set by github actions itself. I think perhaps this action might benefit from a separate parameter, like the checkout action has:
I assume the same would be true for |
Ah, I think I understand what you are trying doing now. Are you running this workflow on GitHub's hosted servers, but trying to create a PR against a repo hosted in GHE? |
@peter-evans That's exactly correct. We're facilitating a process that pulls strings files from our CMS and updates the code repositories. We made it optional to automatically create a PR, which is where your action comes in. We're in a transition phase where some of our repos are still in GHES, but we're moving towards GHEC. So we'd like these workflows to work for both cases. We're pulling code down from the repository with the actions/checkout@v3 action, passing it an explicit Then in the case where we don't want a PR, we're using stefanzweifel/git-auto-commit-action@v4, which uses the credentials stored with the checkout. I think that it would be necessary to add the server-url, and token parameters (and possibly the api url if needed) to the create-pull-request task to allow it to work in this way. |
@mattinger I'm thinking about the best way to support this kind of edge case. Please could you let me know the correct |
@peter-evans I think it differs from installation to installation, but on ours it's at https://github.xxxxx.com/api/v3. The public github server is at https://api.github.com i believe. I would say that you should maybe provide inputs for both of these things, and default them to $GITHUB_SERVER_URL and $GITHUB_API_URL environment variables. I'm not really sure you need to infer them. |
@mattinger I've realised that the way I'm using these environment variables doesn't make sense for use cases where the action is having to work across different GitHub products. So I would like to change how it works and make sure I can correctly support these cases. Inferring the values is my preferred approach because it reduces the amount of support work I need to do in future. There are users of this action who are not as technical as you and will have trouble figuring out the correct values without me helping them. I also don't like to add inputs to the action interface unless I really need to, in order to prevent it becoming bloated and complicated to configure. The server URL is easy to infer, I just need to figure out the API url. This is what I understand so far: GHES: My guess is that GHEC is also Please could you help me confirm the correct value for |
I hitted the same issue, usually the api pattern for enterprise github tends to be as follow: |
I found some time to work on this and I've implemented logic to infer the URLs from the base repository's remote URL. This means it will use the URLs associated with the target repository, not where the workflow is executing. This feature is now added to the v6 release candidate. It would be very helpful if you could try this version of the action and let me know if it works for you. You can use it like this: - uses: peter-evans/create-pull-request@v6-rc I'll be releasing |
I've now released |
My definitions is as follows. The repository was checked out from our enterprise github server (not github.com), so I know there's connectivity.
I've validated that GITHUB_SERVER_URL is correct:
Yet when it comes time to push the PR it's failing with this message:
Based on looking at utils.js, it should be picking up the GITHUB_SERVER_URL variable and validating the local git config against that, but for whatever reason it doesn't seem to working correctly.
The same workflow works on github.com repositories, and i can commit using
stefanzweifel/git-auto-commit-action@v4
for cases where the user doesn't want a PR created, so it's not a permissions issue.The text was updated successfully, but these errors were encountered: