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

Input required and not supplied: deployment_id #161

Open drewbietron opened 10 months ago

drewbietron commented 10 months ago

I am updating this to version 1 and am having trouble with the deployment_id. I have tried many combinations of values for it and I cannot seem to get this to work. I have tried (or thought I did) what the docs explain, as well as trying other values. The closest I've got is just by hardcoding a value (eg 123) as the deployment_id, but that throws other errors.

Here is my current config

 steps:
      - uses: actions/checkout@v3
      - name: Start Web Preview Deployment
        uses: bobheadxi/deployments@v1
        id: deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: ${{ fromJSON('["Production", "Preview"]')[github.ref != 'refs/heads/main'] }}
          deployment_id: ${{ github.event.deployment.id }}
      - name: Web Preview Build
        uses: actions/setup-node@v1
        with:
          node-version: "14.x"
      - name: Deploy
        ... deploy steps
      - name: Update Web Preview Deployment Status
        uses: bobheadxi/deployments@v1
        if: always()
        with:
          step: finish
          token: ${{ secrets.GITHUB_TOKEN }}
          status: ${{ job.status }}
          env: ${{ fromJSON('["Production", "Preview"]')[github.ref != 'refs/heads/main'] }}
          deployment_id: ${{ github.event.deployment.id }}
          debug: true

The output for the debug is

Run bobheadxi/deployments@v1
  with:
    step: finish
    token: ***
    status: failure
    env: Preview
    debug: true
    auto_inactive: false

deployment_id isnt there. Its there if I hard code 123 but my suspicion is that what Im using for the deployment_id isnt a thing.

When I try a value that shows up in debug (eg deployment_id: ${{ github.ref }}), I get the following error

Preview: found 100 existing deployments for env
Preview.1251784709: setting deployment (1dd4c5b78a8100f2d44b56ef848fc652ce3bb144) state to "inactive"
Preview.1251784709 is already inactive; skipping.

Any help would be appreciated 🙏

abivolmv commented 8 months ago

Try using deployment_id: ${{ steps.deployment.outputs.deployment_id }}

      - name: update deployment status
        uses: bobheadxi/deployments@v1.4.0
        if: always()
        with:
          step: finish
          token: ${{ secrets.GITHUB_TOKEN }}
          status: ${{ job.status }}
          deployment_id: ${{ steps.deployment.outputs.deployment_id }}
          env: ${{ steps.deployment.outputs.env }}