Skip to content

Commit

Permalink
feat: allow to manually set repository owner and name #23
Browse files Browse the repository at this point in the history
  • Loading branch information
marceloavf committed Jul 3, 2018
1 parent 24d167e commit 795d49f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Src/GithubReleasePublish/githubReleasePublish.js
Expand Up @@ -17,13 +17,16 @@ const githubEndpointToken = tl.getEndpointAuthorization(githubEndpoint)
const githubRepository = tl.getInput('githubRepository')
? tl.getInput('githubRepository').split('/')
: null
const githubOwner = tl.getInput('githubOwner')
const githubRepositoryName = tl.getInput('githubRepositoryName')
const githubTag = tl.getInput('githubTag')
const githubReleaseTitle = tl.getInput('githubReleaseTitle')
const githubReleaseNotes = tl.getInput('githubReleaseNotes')
const githubApiUrl = tl.getInput('githubApiUrl')
const githubTargetCommitsh = tl.getInput('githubTargetCommitsh')

/** Booleans */
const manuallySetRepository = tl.getBoolInput('manuallySetRepository')
const githubReleaseDraft = tl.getBoolInput('githubReleaseDraft')
const githubReleasePrerelease = tl.getBoolInput('githubReleasePrerelease')
const githubReuseRelease = tl.getBoolInput('githubReuseRelease')
Expand Down Expand Up @@ -54,11 +57,13 @@ let options = {}
options.token =
githubEndpointToken || process.env.GITHUB_TOKEN || process.env.GH_TOKEN // Or you can set an env var called GITHUB_TOKEN instead
options.owner =
(githubRepository && githubRepository[0]) ||
(!manuallySetRepository && githubRepository && githubRepository[0]) ||
githubOwner ||
manifestOptions.owner || // If missing, it will be extracted from manifest (the repository.url field)
undefined
options.repo =
(githubRepository && githubRepository[1]) ||
(!manuallySetRepository && githubRepository && githubRepository[1]) ||
githubRepositoryName ||
manifestOptions.repo || // If missing, it will be extracted from manifest (the repository.url field)
undefined
options.tag =
Expand Down
29 changes: 29 additions & 0 deletions Src/GithubReleasePublish/task.json
Expand Up @@ -37,12 +37,41 @@
"type": "pickList",
"label": "Repository",
"defaultValue": "",
"visibleRule": "manuallySetRepository = false",
"helpMarkDown":
"Name of the GitHub repository. <br>If empty, it will be extracted from <strong>package.json</strong> (the repository.url field).",
"properties": {
"DisableManageLink": "True"
}
},
{
"name": "manuallySetRepository",
"type": "boolean",
"label": "Manually Set Repository",
"defaultValue": "false",
"required": true,
"helpMarkDown": "Manually set Owner and Repository name instead of using the pick list above."
},
{
"name": "githubOwner",
"type": "string",
"label": "Owner",
"defaultValue": "",
"required": true,
"visibleRule": "manuallySetRepository = true",
"helpMarkDown":
"Owner name of the repository. <br>If empty, the owner will be extracted from <strong>package.json</strong>."
},
{
"name": "githubRepositoryName",
"type": "string",
"label": "Repository",
"defaultValue": "",
"required": true,
"visibleRule": "manuallySetRepository = true",
"helpMarkDown":
"Name of the repository. <br>If empty, the repository name will be extracted from <strong>package.json</strong>."
},
{
"name": "githubTag",
"type": "string",
Expand Down

0 comments on commit 795d49f

Please sign in to comment.