Debian Codegraph @

.github/actions/tag-exists/action.yml

raw symbols SCIP
1 name: Return a boolean indicating if a tag already exists for the repository
2
3 #
4 # Returns a simple true/false boolean indicating whether the tag exists or not.
5 #
6 # TODO: Remove once the common repo is public.
7 #
8
9 inputs:
10 token:
11 required: true
12 tag:
13 required: true
14
15 outputs:
16 exists:
17 description: 'Whether the tag exists or not'
18 value: ${{ steps.tag-exists.outputs.EXISTS }}
19
20 runs:
21 using: composite
22
23 steps:
24 - id: tag-exists
25 shell: bash
26 run: |
27 GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/${TAG_NAME}"
28 http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s -H "Authorization: token ${GITHUB_TOKEN}")
29 if [ "$http_status_code" -ne "404" ] ; then
30 echo "EXISTS=true" >> $GITHUB_OUTPUT
31 else
32 echo "EXISTS=false" >> $GITHUB_OUTPUT
33 fi
34 env:
35 TAG_NAME: ${{ inputs.tag }}
36 GITHUB_TOKEN: ${{ inputs.token }}