File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
name : Branch Names
2
- description : Retrieve github branch or tag information without the /ref/* prefix
2
+ description : Retrieve GitHub branch or tag information without the /ref/* prefix
3
3
author : tj-actions
4
4
inputs :
5
5
strip_tag_prefix :
6
6
description : ' The prefix that should be stripped from the tag e.g `v` -> with a tag `v0.0.1` -> returns `0.0.1`'
7
7
default : ' '
8
8
required : false
9
+ strip_branch_prefix :
10
+ description : ' The prefix that should be stripped from the branch e.g `release/` -> with a branch `release/1.0` -> returns `1.0`'
11
+ default : ' '
12
+ required : false
9
13
10
14
outputs :
11
15
is_default :
43
47
GITHUB_HEAD_REF : ${{ github.event.pull_request.head.ref || github.head_ref }}
44
48
GITHUB_EVENT_BASE_REF : ${{ github.event.base_ref }}
45
49
INPUTS_STRIP_TAG_PREFIX : ${{ inputs.strip_tag_prefix }}
50
+ INPUTS_STRIP_BRANCH_PREFIX : ${{ inputs.strip_branch_prefix }}
46
51
run : |
47
52
# "Set branch names..."
48
53
if [[ "$GITHUB_REF" != "refs/tags/"* ]]; then
55
60
REF_BRANCH=${REF/refs\/pull\//}
56
61
REF_BRANCH=${REF_BRANCH/refs\/heads\//}
57
62
63
+ # Strip branch prefix if provided
64
+ REF_BRANCH=${REF_BRANCH/$INPUTS_STRIP_BRANCH_PREFIX/}
65
+ HEAD_REF=${HEAD_REF/$INPUTS_STRIP_BRANCH_PREFIX/}
66
+
58
67
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
59
68
echo "head_ref_branch=$(eval printf "%s" "$HEAD_REF")" >> "$GITHUB_OUTPUT"
60
69
echo "ref_branch=$(eval printf "%s" "$REF_BRANCH")" >> "$GITHUB_OUTPUT"
You can’t perform that action at this time.
0 commit comments