This commit is contained in:
Corey Butler 2020-04-01 14:24:38 -05:00
parent db1da31a6b
commit cc392c0d67
2 changed files with 25 additions and 10 deletions

View File

@ -15,6 +15,9 @@ export default class Tag {
this._tags = null
this._message = null
this._exists = null
this._sha = ''
this._uri = ''
this._ref = ''
}
get name () {
@ -27,6 +30,18 @@ export default class Tag {
}
}
get sha () {
return this._sha || ''
}
get uri () {
return this._uri || ''
}
get ref () {
return this._ref || ''
}
async getMessage () {
if (this._message !== null) {
return this._message
@ -105,6 +120,8 @@ export default class Tag {
// Create reference
let newReference
this._sha = newTag.data.sha
try {
newReference = await github.git.createRef({
owner,
@ -123,17 +140,10 @@ export default class Tag {
throw e
}
core.warning(`Reference ${newReference.data.ref} available at ${newReference.data.url}` + os.EOL)
this._uri = newReference.data.url
this._ref = newReference.data.ref
// Store values for other actions
if (typeof newTag === 'object' && typeof newReference === 'object') {
core.setOutput('tagname', this.name)
core.setOutput('tagsha', newTag.data.sha)
core.setOutput('taguri', newReference.data.url)
core.setOutput('tagmessage', this.message)
core.setOutput('tagref', newReference.data.ref)
core.setOutput('tagcreated', 'yes')
}
core.warning(`Reference ${newReference.data.ref} available at ${newReference.data.url}` + os.EOL)
} else {
core.warning('Cannot push tag (it already exists).')
}

View File

@ -62,6 +62,11 @@ async function run () {
tag.message = core.getInput('tag_message', { required: false }).trim()
await tag.push()
core.setOutput('tagname', tag.name)
core.setOutput('tagsha', tag.sha)
core.setOutput('taguri', tag.uri)
core.setOutput('tagmessage', tag.message)
core.setOutput('tagref', tag.ref)
core.setOutput('tagcreated', 'yes')
} catch (error) {
core.warning(error.message)