Deployment status in PR not starting or updating
Opened this issue ยท 5 comments
I'm not quite sure what is causing this as this configuration has worked before. There's nothing particularly complicated about it and looks similar to the examples given here.
To add to the mystery, the deployment can be seen under Deployments/History but the PR deployment status is stuck in This branch has not been deployed
.
Steps are as follows and job throws no warnings or errors.
Start
- name: Start
uses: bobheadxi/deployments@v1
id: status
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: staging
Debug output:
targeting ***/***
'start' arguments {
stepArgs: { deploymentID: '', override: false, payload: undefined },
coreArgs: {
environment: 'staging',
description: '',
logsURL: 'https://github.com/***/***/commit/***/checks'
}
}
initializing new deployment for staging @ refs/pull/10/merge
created deployment 783773500 for staging @ refs/pull/10/merge
created deployment status 1627565500 with status "in_progress"
Finish
- name: Finish
uses: bobheadxi/deployments@v1
with:
step: finish
override: false
auto_inactive: false
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
env: ${{ steps.status.outputs.env }}
deployment_id: ${{ steps.status.outputs.deployment_id }}
env_url: ***
Debug output:
Run bobheadxi/deployments@v1
with:
step: finish
override: false
auto_inactive: false
token: ***
status: success
env: staging
deployment_id: 783773500
env_url: ***
debug: true
env:
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
BRANCH: testbranch
targeting ***/***
'finish' arguments {
stepArgs: {
status: 'success',
deploymentID: '783773500',
envURL: '***',
override: false,
autoInactive: false
},
finishing deployment for 783773500 with status success
coreArgs: {
environment: 'staging',
description: '',
logsURL: 'https://github.com/***/***/commit/***/checks'
}
}
783773500 status set to success { statusID: 1627565500 }
This looks like a quirk of GitHub PR ref. The PR ref is a "magical" merge ref, not a real branch and GitHub's deployment API doesn't appear to special case this. TL;DR: This action needs to use head_ref
if it's available over context.ref.
Looks like that was the problem. Thanks a lot.
Hey @alipas could you maybe elaborate a bit more on how you resolved this issue? Thx ๐
@wagnertimo Passing in the head_ref
like this worked for me:
- name: Start GitHub deployment
uses: bobheadxi/deployments@v1.4.0
id: deployment
with:
env: release
ref: ${{ github.head_ref }}
step: start
token: ${{ secrets.GITHUB_TOKEN }}
^ This. For ref:
with both push
and pull_request
, you can do ${{ github.ref || github.head_ref }}
to handle both variations.