mirror of
https://github.com/ButlerLogic/action-autotag.git
synced 2024-11-24 17:21:07 +07:00
WIP
This commit is contained in:
parent
db1da31a6b
commit
cc392c0d67
@ -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).')
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user