mirror of
https://github.com/tj-actions/branch-names.git
synced 2024-11-24 02:23:51 +08:00
Merge pull request #89 from tj-actions/feature/add-support-for-escaping-valid-branch-names
Escape valid branch names
This commit is contained in:
commit
40efc93c59
29
action.yml
29
action.yml
@ -36,13 +36,20 @@ runs:
|
|||||||
- id: branch
|
- id: branch
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ github.ref }}" != "refs/tags/"* ]]; then
|
if [[ "${{ github.ref }}" != "refs/tags/"* ]]; then
|
||||||
BASE_REF=${{ github.base_ref }}
|
BASE_REF=$(printf "%q" "${{ github.base_ref }}")
|
||||||
HEAD_REF=${{ github.head_ref }}
|
HEAD_REF=$(printf "%q" "${{ github.head_ref }}")
|
||||||
REF=${{ github.ref }}
|
REF=$(printf "%q" "${{ github.ref }}")
|
||||||
echo "::set-output name=base_ref_branch::${BASE_REF/refs\/heads\//}"
|
|
||||||
echo "::set-output name=head_ref_branch::${HEAD_REF/refs\/heads\//}"
|
BASE_REF=${BASE_REF/refs\/heads\//}
|
||||||
|
HEAD_REF=${HEAD_REF/refs\/heads\//}
|
||||||
|
|
||||||
|
echo "::set-output name=base_ref_branch::$(eval printf "%s" "$BASE_REF")"
|
||||||
|
echo "::set-output name=head_ref_branch::$(eval printf "%s" "$HEAD_REF")"
|
||||||
|
|
||||||
REF_BRANCH=${REF/refs\/pull\//}
|
REF_BRANCH=${REF/refs\/pull\//}
|
||||||
echo "::set-output name=ref_branch::${REF_BRANCH/refs\/heads\//}"
|
REF_BRANCH=${REF_BRANCH/refs\/heads\//}
|
||||||
|
|
||||||
|
echo "::set-output name=ref_branch::$(eval printf "%s" "$REF_BRANCH")"
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
- id: current_branch
|
- id: current_branch
|
||||||
@ -54,9 +61,10 @@ runs:
|
|||||||
echo "::set-output name=current_branch::${{ steps.branch.outputs.ref_branch }}"
|
echo "::set-output name=current_branch::${{ steps.branch.outputs.ref_branch }}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
REF=${{ github.ref }}
|
REF=$(printf "%q" "${{ github.ref }}")
|
||||||
REF_BRANCH=${REF/refs\/tags\/${{ inputs.strip_tag_prefix }}/}
|
REF_BRANCH=${REF/refs\/tags\/${{ inputs.strip_tag_prefix }}/}
|
||||||
echo "::set-output name=current_branch::$REF_BRANCH"
|
|
||||||
|
echo "::set-output name=current_branch::$(eval printf "%s" "$REF_BRANCH")"
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
- id: default
|
- id: default
|
||||||
@ -72,9 +80,10 @@ runs:
|
|||||||
- id: tag
|
- id: tag
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
|
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
|
||||||
REF=${{ github.ref }}
|
REF=$(printf "%q" "${{ 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::$(eval printf "%s" "$TAG")"
|
||||||
echo "::set-output name=is_tag::true"
|
echo "::set-output name=is_tag::true"
|
||||||
else
|
else
|
||||||
echo "::set-output name=is_tag::false"
|
echo "::set-output name=is_tag::false"
|
||||||
|
Loading…
Reference in New Issue
Block a user