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

GHES support. Allow projects outside github.com #210

Closed
wants to merge 1 commit into from

Conversation

andreineculau
Copy link

I'm trying to use this action on GHES, and I see there's a strict URL match for github.com projects though the domain isn't use thereafter.

@andreineculau andreineculau requested a review from a team as a code owner September 13, 2022 12:24
@@ -4,7 +4,7 @@ import * as github from '@actions/github'
// TODO: Ensure this (and the Octokit client) works for non-git.luolix.top URLs, as well.
// https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
const urlParse =
/^(?:https:\/\/)?github\.com\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
/^(?:https:\/\/)?[^/]+\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
Copy link
Contributor

@iansan5653 iansan5653 Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The (?:https:\/\/)?[^/]+ part of this expression seems like it could be buggy. If the URL protocol is https:// it will work fine, but if it's anything else (like http://), the first group will pass because it's optional and then the [^/] part will unexpectedly stop at the first forward-slash, which will be in the protocol.

Maybe we shouldn't have a 'beginning-of-string' part of the regex at all? It doesn't seem to really matter what goes before or after the part of the URL we care about. That seems like it would allow us to make a more robust regex that just searches anywhere in the string for a /orgs/*/projects/* match:

\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iansan5653 Anyway I got an answer that this action not working with GHES. But this change will be needed 100% :)

#214

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, I forgot the new Projects hasn't shipped to GHES yet 😄

I'm going to close this PR for now but we can revisit & reopen it once that's shipped

Copy link
Contributor

@iansan5653 iansan5653 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any issues with this idea. Have you been able to test to make sure it does work with GHES after this change?

There is a comment on line 5 and an error message on line 82 we should update as well

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

Successfully merging this pull request may close these issues.

None yet

3 participants