You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
692 B

const AbstractGitState = require('./AbstractGitState')
class TagState extends AbstractGitState {
async apply() {
if ( !(await this.check()) ) {
const repo = await this._repo()
await repo.create_tag(this._config.tag)
}
}
async check() {
const repo = await this._repo()
try {
await repo.get_tag(this._config.tag)
return true
} catch (e) {
return false
}
}
async reverse() {
if ( await this.check() ) {
const repo = await this._repo()
await repo.delete_tag(this._config.tag)
}
}
}
module.exports = exports = TagState