From 76aefa7f40620e3af00de7e2a2bc5462e0e56c97 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sat, 24 Apr 2021 20:19:24 -0400 Subject: [PATCH 1/2] Remove unused inputs --- action.yml | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/action.yml b/action.yml index f7a7aea..83545d0 100644 --- a/action.yml +++ b/action.yml @@ -2,18 +2,6 @@ name: branch-names description: Retrieve giithub branch information without `/ref/*` prefix author: tj-actions inputs: - base_ref: - description: 'The target branch of a pull request' - default: ${{ github.base_ref }} - required: false - head_ref: - description: 'The source branch of a pull request' - default: ${{ github.head_ref }} - required: false - ref: - description: 'The branch that triggered the workflow run.' - default: ${{ github.ref }} - required: false strip_tag_prefix: description: 'The tag prefix to strip i.e v0.0.1 -> (strip v) -> 0.0.1' default: '' @@ -44,10 +32,10 @@ runs: steps: - id: branch run: | - if [[ !${{ startsWith(inputs.ref, 'refs/tags/') }} ]]; then - export BASE_REF=${{ inputs.base_ref }} - export HEAD_REF=${{ inputs.head_ref }} - export REF=${{ inputs.ref }} + if [[ !${{ startsWith(github.ref, 'refs/tags/') }} ]]; then + export BASE_REF=${{ github.base_ref }} + export HEAD_REF=${{ github.head_ref }} + export REF=${{ github.ref }} echo "::set-output name=base_ref_branch::${BASE_REF/refs\/heads\//}" echo "::set-output name=head_ref_branch::${HEAD_REF/refs\/heads\//}" REF_BRANCH=${REF/refs\/pull\//} @@ -72,8 +60,8 @@ runs: shell: bash - id: tag run: | - if [[ ${{ startsWith(inputs.ref, 'refs/tags/') }} ]]; then - export REF=${{ inputs.ref }} + if [[ ${{ startsWith(github.ref, 'refs/tags/') }} ]]; then + export REF=${{ github.ref }} TAG=${REF/refs\/tags\${{ inputs.strip_tag_prefix }}//} echo "::set-output name=tag::$TAG" fi From 9feb728ef3e7be5185c5f65261d0eb1a19468242 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sat, 24 Apr 2021 20:33:50 -0400 Subject: [PATCH 2/2] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index ae26937..fb7f896 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ Get branch or tag information without the `/ref/*` prefix | tag | `string` | `v0.0.1` *OR* `0.0.1` | The tag that triggered the workflow run | +## Inputs + +| Input | type | default | Description | +|:-----------------:|:---------:|:--------:|:-----------------------:| +| strip_tag_prefix | `string` | `''` | The tag prefix to strip
*i.e `v0.0.1` -> `v` -> `0.0.1`* | + ## Usage ```yaml