Skip to content

Commit d27c414

Browse files
committed
Apply a docker tag discriminant
1 parent 0b0aac7 commit d27c414

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/tests.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,13 @@ jobs:
127127
HEAD_SHA=$( echo ${{ github.event.pull_request.head.sha || github.sha }} | head -c7 )
128128
echo "::set-output name=head_sha::$HEAD_SHA"
129129
130-
- name: Should Push Docker Branch?
131-
id: push-branch
130+
- name: Get Docker Tag
131+
id: get-docker-tag-spec
132132
run: |
133133
if [[ "${{ github.event_name }}" == 'push' ]]; then
134-
echo "::set-output name=branch::type=ref,event=branch"
134+
echo "::set-output name=spec::type=ref,event=branch"
135+
else if [[ "${{ github.event_name }}" == 'pull_request' ]]; then
136+
echo "::set-output name=spec::type=ref,event=pr"
135137
fi
136138
137139
- name: Extract Metadata (tags, labels) For Docker
@@ -140,12 +142,12 @@ jobs:
140142
with:
141143
images: freyrcli/freyrjs-git
142144
tags: |
143-
type=ref,event=pr
144-
${{ steps.push-branch.outputs.branch }}
145+
${{ steps.get-docker-tag-spec.outputs.spec }}
145146
type=raw,value=${{ steps.get-shas.outputs.head_sha }}
146147
147148
- name: Extract Tags
148149
id: get-docker-tag
150+
if: github.event_name == 'pull_request'
149151
run: |
150152
PR_TAG=$( echo "${{ steps.docker-meta.outputs.tags }}" | sed 's/freyrcli\/freyrjs-git://g' )
151153
echo "::set-output name=tag::$PR_TAG"

0 commit comments

Comments
 (0)