Skip to content

Commit

Permalink
Fix: use a sha instead of 'refs/heads/master' as ref for deployments
Browse files Browse the repository at this point in the history
When merging a second pull-request while the first has not created
a deployment yet, the 'refs/heads/master' resolves to the wrong
sha-hash, showing the wrong commit being deployed (it deploys the
commit of the first, while showing it did the one of the last).
  • Loading branch information
TrueBrain committed Dec 28, 2019
1 parent 787d526 commit 05be85c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ jobs:
echo "::set-output name=ref::${REF}"
echo "Ref: ${REF}"
SHA="$(git rev-parse --verify ${REF})"
echo "::set-output name=sha::${SHA}"
echo "Sha: ${SHA}"
if [ "${REF}" = "refs/heads/master" ]; then
ENVIRONMENT="staging"
TAG="development"
Expand Down Expand Up @@ -130,7 +134,7 @@ jobs:
github.repos.createDeployment({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
ref: "${{ steps.vars.outputs.ref }}",
ref: "${{ steps.vars.outputs.sha }}",
auto_merge: false,
environment: "${{ steps.vars.outputs.environment }}",
required_contexts: [],
Expand Down

0 comments on commit 05be85c

Please sign in to comment.