Skip to content

Allow if Blocks in steps #677

Description

@fchorney

Describe the enhancement
I'm finding that it is quite annoying to have to define an if condition for every single item in the steps section of a test matrix. It would be great if you could define a block per se

Code Snippet
For instance, let's say I have a setup like so

 # Linux-name: Wait/Sleep
uses: jakejarvis/wait-action@v0.1.0if: ${{runner.os=='Linux'}}with:
time: '1m'-name: CollectDockerLogs
uses: jwalton/gh-docker-logs@v1.0.0if: ${{runner.os=='Linux'}}-name: Checkrunningcontainers
run: dockerps-aif: ${{runner.os=='Linux'}}-name: SetPGHOSTonLinux
run: echo"PGHOST=localhost">>$GITHUB_ENVif: ${{runner.os=='Linux'}}
# MacOS-name: SetPGUSERonmacOSrun: |echo"PGUSER=$USER">>$GITHUB_ENVecho"LIBPQJL_DATABASE_USER=$USER">>$GITHUB_ENVif: ${{runner.os=='macOS'}}-name: StartHomebrewPostgreSQLservice
run: pg_ctl-D/usr/local/var/postgresstartif: ${{runner.os=='macOS'}}
# Windows-name: AddPostgreSQLtoPathrun: |echo $env:PGBIN
echo $env:PGBIN|Out-File-FilePath$env:GITHUB_PATH-Encodingutf8-Appendif: ${{runner.os=='Windows'}}-name: StartWindowsPostgreSQLservicerun: |pg_ctl-D $env:PGDATAstartpg_ctl-D $env:PGDATAstatusif: ${{runner.os=='Windows'}}

It would be awesome if it could be formatted like so:

 # Linux-if: ${{runner.os=='Linux'}}-name: Wait/Sleep
uses: jakejarvis/wait-action@v0.1.0with:
time: '1m'-name: CollectDockerLogs
uses: jwalton/gh-docker-logs@v1.0.0-name: Checkrunningcontainers
run: dockerps-a-name: SetPGHOSTonLinux
run: echo"PGHOST=localhost">>$GITHUB_ENV
# MacOS-if: ${{runner.os=='macOS'}}-name: SetPGUSERonmacOSrun: |echo"PGUSER=$USER">>$GITHUB_ENVecho"LIBPQJL_DATABASE_USER=$USER">>$GITHUB_ENV-name: StartHomebrewPostgreSQLservice
run: pg_ctl-D/usr/local/var/postgresstart
# Windows-if: ${{runner.os=='Windows'}}-name: AddPostgreSQLtoPathrun: |echo $env:PGBIN
echo $env:PGBIN|Out-File-FilePath$env:GITHUB_PATH-Encodingutf8-Append-name: StartWindowsPostgreSQLservicerun: |pg_ctl-D $env:PGDATAstartpg_ctl-D $env:PGDATAstatus

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions