Skip to content
/ tag_check Public

Checks the code for a version. Compares that version with GitHub.

License

Notifications You must be signed in to change notification settings

dudo/tag_check

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github Tag Check

Supported languages/frameworks

This currently looks for versions in the following files:

  • pyproject.toml
  • package.json
  • ./lib/*/version.rb
  • Dockerfile

Usage

See action.yml for inputs. The usage is very straightforward:

  1. Look for a version within your app.
  2. Check GitHub for a matching tag.
  3. Exit if a tag is found, or can't reach GitHub.

Use when you want to tag a commit.

# .github/workflows/git_tag.yaml

on:
  push:
    branches:
      - master
name: Git Tag
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
  check_version:
    name: Check Version
    runs-on: ubuntu-latest
    outputs:
      git_tag_name: ${{ steps.tag_check.outputs.git_tag_name }}
    steps:
      - uses: actions/checkout@v2 # https://github.com/actions/checkout
      - uses: dudo/[email protected]
        id: tag_check
        with:
          git_tag_prefix: v
  push_tag:
    name: Push Tag
    needs: check_version
    runs-on: ubuntu-latest
    steps:
    - name: Push Tag to GitHub
      run: |
        curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
        -d "{\"ref\": \"refs/tags/${{needs.check_version.outputs.git_tag_name}}\", \"sha\": \"${GITHUB_SHA}\"}" \
        "https://api.github.com/repos/${GITHUB_REPOSITORY}/git/refs"

Or when you want to ensure you updated your version file.

# .github/workflows/check_tag.yaml

on:
  pull_request:
    branches:
      - master
name: Check Version
jobs:
  check_version:
    name: Check Version
    runs-on: ubuntu-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2 # https://github.com/actions/checkout
      - uses: dudo/[email protected]
        with:
          git_tag_prefix: v

About

Checks the code for a version. Compares that version with GitHub.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published