'Workaround for the runOnce deployment strategy while translating Azure YAML Pipeline to GitHub Actions YAML

I am aware that the Azure DevOps strategy "runOnce" does not have an equivalent GitHub Action yet. And I am seeking a workaround for that since I am migrating my DevOps pipelines from Azure DevOps to GitHub Actions.

A sample YAML Block for referring the kind of pipelines I'm translating from ADO to GitHub actions can be found below:

stage: DEV
    condition: eq(variables['Build.SourceBranch'], 'refs/heads/dev')
    jobs:
      - deployment: Deploy
        environment: dev
        strategy:
          runOnce:
            deploy:
              steps:
                - task: DownloadPipelineArtifact@2
                  inputs:
                    buildType: 'current'
                    artifactName: 'drop'
                    targetPath: '$(System.ArtifactsDirectory)'

In simple terms, how do I convert the runOnce deployment strategy in Azure to GitHub Actions?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source