Skip to content

Commit cf96005

Browse files
generate-docker-image-tags supports release triggers (#18)
* Updated allowed actions for generate-docker-image-tags * No PR_NUMBER on release event * fixed PR_NUMBER strings * rm accidental double quote * Update generate-docker-image-tags/action.yml Co-authored-by: Mikhail Andrenkov <[email protected]> * Fix quotes * more quote fmt * more PR number debugging * test rm quotes * backslash * fix grep pipe usage Co-authored-by: Mikhail Andrenkov <[email protected]>
1 parent 68fe1d4 commit cf96005

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

generate-docker-image-tags/action.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ runs:
3838
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]
3939
then
4040
BRANCH=$GITHUB_HEAD_REF
41-
elif [ "$GITHUB_EVENT_NAME" == "push" ]
41+
elif [ "$GITHUB_EVENT_NAME" == "push" ] || [ "$GITHUB_EVENT_NAME" == "release" ]
4242
then
4343
BRANCH=${GITHUB_REF##*/}
4444
else
45-
printf 'Cannot determine tags: Workflow must be triggered by "push" or "pull_request" event.' && exit 1
45+
printf 'Cannot determine tags: Workflow must be triggered by "push", "pull_request", or "release" event.' && exit 1
4646
fi
4747
4848
printf "::set-output name=branch::$BRANCH"
@@ -62,14 +62,17 @@ runs:
6262
6363
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]
6464
then
65-
PR_NUMBER=${{ github.event.number }}
66-
else
65+
PR_NUMBER="${{ github.event.number }}"
66+
elif [ "$GITHUB_EVENT_NAME" == "push" ]
67+
then
6768
# Workflow was triggered by a "push" event.
68-
PR_NUMBER=$(
69-
echo "${{ github.event.head_commit.message }}" \
70-
| grep -o "(#[0-9]*)" \
71-
| sed 's/[#()]//g'
69+
PR_NUMBER=$( \
70+
(echo "${{ github.event.head_commit.message }}" \
71+
| grep -o "\(#[0-9]\+\)" || true) \
72+
| sed "s/[#()]//g" \
7273
)
74+
else
75+
PR_NUMBER=""
7376
fi
7477
7578
# Add additional tags for each Story ID associated with this PR.

0 commit comments

Comments
 (0)