Skip to content
stop-circle

GitHub Action

tag-protector

v1 Latest version

tag-protector

stop-circle

tag-protector

Rejects tag that doesn't follow the rule

Installation

Copy and paste the following snippet into your .yml file.

              

- name: tag-protector

uses: KeisukeYamashita/tag-protector@v1

Learn more about this action in KeisukeYamashita/tag-protector

Choose a version

Tap Protector

CI GitHub Marketplace Mergify Status

A GitHub Action that deletes the tag if a tag that doesn't follow the rule is pushed. If you release with tag push, there might be many tags that didn't trigger the release workflow and kind of make your repo messy.

You can also select wether as tag push of malform format will fail the workflow or not.

This action extract the number from a pull request which has triggered this by default. You don't need to specify the pull request number by ${{ github.event.pull_request.number }}.

Usage

      - name: Reject tags
        uses: KeisukeYamashita/tag-protector@v1
        rule: v[0-9]{1,}.[0-9]{1,}-[0-9]{1,}

Trigger by pull_request event with custom check

This is just an example to show one way in which this action can be used.

on: pull_request
jobs:
  auto-merge:
    - name: Reject tags
      uses: KeisukeYamashita/tag-protector@v1
      with:
        rule: v[0-9]{1,}.[0-9]{1,}-[0-9]{1,}

Action inputs

Name Description Default
deleteTag Delete the tag that doesn't follow the rule or not' true
rule Regex of the tag format should be -(Required)
failWorkflow Failed the workflow or not false
repostiory The GitHub repository containing the pull request Current repository
token GITHUB_TOKEN or a repo scoped PAT. GITHUB_TOKEN

Action outputs

Name Description
ref Tag. It doesn't contain /ref/tags prefix.

License

MIT