Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment status in PR not starting or updating #137

Open
alipas opened this issue Jan 31, 2023 · 5 comments
Open

Deployment status in PR not starting or updating #137

alipas opened this issue Jan 31, 2023 · 5 comments

Comments

@alipas
Copy link

alipas commented Jan 31, 2023

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 }
@RichiCoder1
Copy link

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.

@alipas
Copy link
Author

alipas commented Feb 7, 2023

Looks like that was the problem. Thanks a lot.

@wagnertimo
Copy link

Hey @alipas could you maybe elaborate a bit more on how you resolved this issue? Thx 🙏

@psirenny
Copy link

@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 }}

@RichiCoder1
Copy link

^ This. For ref: with both push and pull_request, you can do ${{ github.ref || github.head_ref }} to handle both variations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants