nimblehq / branch-tag-action

Extract a valid branch tag from tag ref

Home Page:https://nimblehq.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Branch tag action

This action returns the valid docker image tag name by extracting the branch from branch or tag ref and replacing / by - using Shell Parameter Expansion

refs/heads/feature/add-new-action -> feature-add-new-action
refs/tags/1.0.0 -> 1.0.0
refs/heads/master -> latest

Inputs

ref

Required The name of the branch or tag ref. Default is the current branch that runs this action.

Outputs

branch_tag

The valid branch tag

Environment variables

BRANCH_TAG

The valid branch tag

Example usage

uses: nimblehq/branch-tag-action@v1
# or
uses: nimblehq/branch-tag-action@v1
with:
  ref: 'feature/add-new-action'

Full workflow

on: [push]

jobs:
  print_branch_tag:
    runs-on: ubuntu-latest
    name: A job to print branch tag
    steps:
      - uses: actions/checkout@v2

      - uses: nimblehq/branch-tag-action@v1
        id: extract

      # Use the output/env from the `extract` step
      - name: Print the values
        run: |
          echo "The branch tag is ${{ steps.extract.outputs.branch_tag }}"
          echo "or ${{ env.BRANCH_TAG }}"

License

This project is Copyright (c) 2014-2020 Nimble. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

Nimble

This project is maintained and funded by Nimble.

We love open source and do our part in sharing our work with the community! See our other projects or hire our team to help build your product.

About

Extract a valid branch tag from tag ref

https://nimblehq.co

License:MIT License


Languages

Language:Shell 82.1%Language:Dockerfile 17.9%