bobheadxi / deployments

🔖 GitHub Action for working painlessly with deployment statuses
https://github.com/marketplace/actions/github-deployments
MIT License
385 stars 64 forks source link

Status of branch was not updated #114

Closed ai closed 2 years ago

ai commented 2 years ago

Deployment was created in Environments, but I still have This branch has not been deployed in the pull request

Снимок экрана от 2022-08-12 03-03-17

on:
  push:
    branches:
      - main
  pull_request:
jobs:
  preview:
    runs-on: ubuntu-latest
    if: github.ref != 'refs/heads/main'
    steps:
      - name: Notify about new deployment
        uses: bobheadxi/deployments@v1
        id: deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: preview-${{ github.event.number }}
      - name: Deploy files
        id: deploy
        …
      - name: Update deployment status
        uses: bobheadxi/deployments@v1
        with:
          step: finish
          token: ${{ secrets.GITHUB_TOKEN }}
          status: ${{ job.status }}
          env: ${{ steps.deployment.outputs.env }}
          env_url: ${{ steps.deploy.outputs.url }}
          deployment_id: ${{ steps.deployment.outputs.deployment_id }}
ai commented 2 years ago

Fixed by adding ref: ${{ github.head_ref }} to deployment task

ai commented 2 years ago

Should we add ref to the main example in docs?

vhatsura commented 2 years ago

Hey, @ai

In your example, ref is needed because your workflow is triggered from a pull request with reference in the refs/pull/pr_number format. For this reason, the deployment is created against a ref instead of your branch.