Block action if already running

Hi every one. I would like to know if it’s possible to block an action when it’s already running. For example, I have an action on push develop (reality on merge request) to deploy on server by SSH :

name: Deploy Preprod
on:
  push:
    branches:
      - develop
jobs:
  build-ssh:
    name: Build With SSHKey
    runs-on: ubuntu-latest
    steps:
      - name: Executing remote command
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.PREPROD_HOST }}
          USERNAME: ${{ secrets.PREPROD_USER }}
          PORT: ${{ secrets.PREPROD_PORT }}
          KEY: ${{ secrets.PREPROD_SSHKEY }}
          command_timeout: 20m
          script: |
            cd winelidays
            git pull --rebase
            git reset --hard ${{ github.sha }}
            sed -i "s/GITHUB_API_PROJECT_VERSION=.*$/GITHUB_API_PROJECT_VERSION=${{ github.sha }}/g" .env
            sed -i "s/GITHUB_API_PROJECT_VERSION=.*$/GITHUB_API_PROJECT_VERSION=${{ github.sha }}/g" symfony/.env
            ./deploy.sh

If I merge 2 pull requests, actions will be launch at the same time and in parallel. I want a synchrone launch !

Thanks for our help :slight_smile:

Hi @Ciloe,

Glad to see you in Github Community Forum!

Only cancel the workflow can block the running and latter actions.

However the action in your workflow will execute remote ssh commands, when you merge two pull requests, if the action is running, you cannot block one of them to start a synchrone launch.

Github are planning to add ‘manual approval’ to the workflow, you can find more details here: https://github.com/github/roadmap/issues/99.

Thanks