mirror of
https://github.com/tj-actions/branch-names.git
synced 2024-12-27 14:27:59 +08:00
Merge pull request #27 from tj-actions/remove-unused-inputs
Remove unused inputs
This commit is contained in:
commit
509c3124ab
@ -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 |
|
| 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 <br> *i.e `v0.0.1` -> `v` -> `0.0.1`* |
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
24
action.yml
24
action.yml
@ -2,18 +2,6 @@ name: branch-names
|
|||||||
description: Retrieve giithub branch information without `/ref/*` prefix
|
description: Retrieve giithub branch information without `/ref/*` prefix
|
||||||
author: tj-actions
|
author: tj-actions
|
||||||
inputs:
|
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:
|
strip_tag_prefix:
|
||||||
description: 'The tag prefix to strip i.e v0.0.1 -> (strip v) -> 0.0.1'
|
description: 'The tag prefix to strip i.e v0.0.1 -> (strip v) -> 0.0.1'
|
||||||
default: ''
|
default: ''
|
||||||
@ -44,10 +32,10 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- id: branch
|
- id: branch
|
||||||
run: |
|
run: |
|
||||||
if [[ !${{ startsWith(inputs.ref, 'refs/tags/') }} ]]; then
|
if [[ !${{ startsWith(github.ref, 'refs/tags/') }} ]]; then
|
||||||
export BASE_REF=${{ inputs.base_ref }}
|
export BASE_REF=${{ github.base_ref }}
|
||||||
export HEAD_REF=${{ inputs.head_ref }}
|
export HEAD_REF=${{ github.head_ref }}
|
||||||
export REF=${{ inputs.ref }}
|
export REF=${{ github.ref }}
|
||||||
echo "::set-output name=base_ref_branch::${BASE_REF/refs\/heads\//}"
|
echo "::set-output name=base_ref_branch::${BASE_REF/refs\/heads\//}"
|
||||||
echo "::set-output name=head_ref_branch::${HEAD_REF/refs\/heads\//}"
|
echo "::set-output name=head_ref_branch::${HEAD_REF/refs\/heads\//}"
|
||||||
REF_BRANCH=${REF/refs\/pull\//}
|
REF_BRANCH=${REF/refs\/pull\//}
|
||||||
@ -72,8 +60,8 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- id: tag
|
- id: tag
|
||||||
run: |
|
run: |
|
||||||
if [[ ${{ startsWith(inputs.ref, 'refs/tags/') }} ]]; then
|
if [[ ${{ startsWith(github.ref, 'refs/tags/') }} ]]; then
|
||||||
export REF=${{ inputs.ref }}
|
export REF=${{ github.ref }}
|
||||||
TAG=${REF/refs\/tags\${{ inputs.strip_tag_prefix }}//}
|
TAG=${REF/refs\/tags\${{ inputs.strip_tag_prefix }}//}
|
||||||
echo "::set-output name=tag::$TAG"
|
echo "::set-output name=tag::$TAG"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user