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