Skip to content

Unable to cancel workflow #507

Open
Open
@c-ameron

Description

@c-ameron

Hi,

I'm unable to cancel a workflow when I'm using the action. This is for both Code Deploy and a normal ECS service update. I'm running on hosted github actions, I'm also using the input wait-for-service-stability: true. When I click 'cancel workflow' (even multiple times), it looks like the action captures the cancellation and it runs to completion. Instead, I'd like it to immediately cancel the workflow. Ideally it would rollback, however just a cancellation is fine and I can have my own rollback logic.

In my case this rollback was a simple

    - name: Cancel Deployment if job cancelled
      if: cancelled()
      run: |
        deploymentId="$(aws deploy list-deployments --application-name ${{ inputs.application_name }} --deployment-group-name ${{ inputs.ecs_service_name }} --max-items 1 | jq -r .deployments[])"
        deploymentStatus="$(aws deploy get-deployment --deployment-id $deploymentId | jq -r .deploymentInfo.status)"
        if ! [[ $deploymentStatus =~ ^(Succeeded|Failed|Stopped)$ ]]; then
          aws deploy stop-deployment --deployment-id $deploymentId
        fi

Let me know if you need any more details.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions