Skip to content

How to automatically close waiting jobs related to deployment review when pull request is closed/merged? #62390

Answered by ghoullier
ghoullier asked this question in Actions
Discussion options

You must be logged in to vote

I've created a github action to solve this problem:

Action

.github/actions/reject-pending-deployments/action.yaml

name: Reject pending deployments

inputs:
  token:
    description: Github Access Token
    required: true
  environment:
    description: Environment
    required: true
  branch:
    description: Branch
    default: ${{ github.event.pull_request.head.ref }}
  preserve-latest:
    description: Preserve latest pending deployment
    default: false
  sha:
    description: Git sha1
    default: ${{ github.event.pull_request.head.sha }}

runs:
  using: "composite"
  steps:
    - id: set-jq-filter
      shell: bash
      run: |
        JQ_FILTER_NONE='.workflow_runs | .[] | .id'

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ghoullier
Comment options

@Mittelblut9
Comment options

@ghoullier
Comment options

Answer selected by ghoullier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
2 participants