-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(project): merge pull request #809 from semantic-release/fix/pro…
…ject-id Use project ID for API calls if available
- Loading branch information
Showing
13 changed files
with
304 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import escapeStringRegexp from "escape-string-regexp"; | ||
import parseUrl from "parse-url"; | ||
import urlJoin from "url-join"; | ||
|
||
export default ( | ||
{ envCi: { service } = {}, env: { CI_PROJECT_ID, CI_PROJECT_PATH } }, | ||
gitlabUrl, | ||
gitlabApiUrl, | ||
repositoryUrl | ||
) => { | ||
const projectId = service === "gitlab" && CI_PROJECT_ID ? CI_PROJECT_ID : null; | ||
const projectPath = | ||
service === "gitlab" && CI_PROJECT_PATH | ||
? CI_PROJECT_PATH | ||
: parseUrl(repositoryUrl) | ||
.pathname.replace(new RegExp(`^${escapeStringRegexp(parseUrl(gitlabUrl).pathname)}`), "") | ||
.replace(/^\//, "") | ||
.replace(/\/$/, "") | ||
.replace(/\.git$/, ""); | ||
const encodedProjectPath = encodeURIComponent(projectPath); | ||
const projectApiUrl = urlJoin(gitlabApiUrl, `/projects/${projectId ?? encodedProjectPath}`); | ||
return { | ||
projectPath, | ||
encodedProjectPath, | ||
projectApiUrl, | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.