Skip to content

Commit

Permalink
skip github action execution if required env vars are not present (#1445
Browse files Browse the repository at this point in the history
)
  • Loading branch information
abendt committed Jan 18, 2022
1 parent 46f0f78 commit 323228b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ env:
MAVEN_OPTS: "-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"

jobs:
check-env:
runs-on: ubuntu-latest
outputs:
repo-token-available: ${{ steps.repo-token.outputs.defined }}
steps:
- id: repo-token
env:
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
if: "${{ env.REPO_TOKEN != '' }}"
run: echo "::set-output name=defined::true"

java8-build:
runs-on: ubuntu-latest
steps:
Expand All @@ -26,6 +37,7 @@ jobs:
run: mvn -B -Pjava8 clean verify --file pom.xml

java11-build:
needs: [ check-env ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -37,7 +49,7 @@ jobs:
run: |
mvn -B -Pjava11 clean verify jacoco:report --file pom.xml
- name: Coveralls report
if: ${{ (github.repository == 'FluentLenium/FluentLenium' && github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository) }}
if: needs.check-env.outputs.repo-token-available == 'true'
env:
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
run: |
Expand Down
33 changes: 22 additions & 11 deletions .github/workflows/e2e-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ env:
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"

jobs:
dump:
check-env:
runs-on: ubuntu-latest
outputs:
browserStackUrl-available: ${{ steps.browserStackUrl.outputs.defined }}
steps:
- name: print context
- id: browserStackUrl
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
URL: ${{ secrets.BROWSER_STACK_URL }}
if: "${{ env.URL != '' }}"
run: echo "::set-output name=defined::true"

edge:
if: github.event.pull_request.head.repo.full_name == github.repository
needs: [ check-env ]
if: needs.check-env.outputs.browserStackUrl-available == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -31,7 +36,8 @@ jobs:
run: mvn -B -nsu -Pexamples -pl examples/spring clean test -DbrowserName=edge -Dmobile.simulator=false -DuseHub=true -DgridUrl=${{ secrets.BROWSER_STACK_URL }}

ie:
if: github.event.pull_request.head.repo.full_name == github.repository
needs: [ check-env ]
if: needs.check-env.outputs.browserStackUrl-available == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -45,7 +51,8 @@ jobs:
run: mvn -B -nsu -Pexamples -pl examples/spring clean test -DbrowserName=ie -Dmobile.simulator=false -DuseHub=true -DgridUrl=${{ secrets.BROWSER_STACK_URL }}

chrome:
if: github.event.pull_request.head.repo.full_name == github.repository
needs: [ check-env ]
if: needs.check-env.outputs.browserStackUrl-available == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -59,7 +66,8 @@ jobs:
run: mvn -B -nsu -Pexamples -pl examples/spring clean test -DbrowserName=chrome -Dmobile.simulator=false -DuseHub=true -DgridUrl=${{ secrets.BROWSER_STACK_URL }}

firefox:
if: github.event.pull_request.head.repo.full_name == github.repository
needs: [ check-env ]
if: needs.check-env.outputs.browserStackUrl-available == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -73,7 +81,8 @@ jobs:
run: mvn -B -nsu -Pexamples -pl examples/spring clean test -DbrowserName=firefox -Dmobile.simulator=false -DuseHub=true -DgridUrl=${{ secrets.BROWSER_STACK_URL }}

safari:
if: github.event.pull_request.head.repo.full_name == github.repository
needs: [ check-env ]
if: needs.check-env.outputs.browserStackUrl-available == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -87,7 +96,8 @@ jobs:
run: mvn -B -nsu -Pexamples -pl examples/spring clean test -DbrowserName=safari -Dmobile.simulator=false -DuseHub=true -DgridUrl=${{ secrets.BROWSER_STACK_URL }}

iphone:
if: github.event.pull_request.head.repo.full_name == github.repository
needs: [ check-env ]
if: needs.check-env.outputs.browserStackUrl-available == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -101,7 +111,8 @@ jobs:
run: mvn -B -nsu -Pexamples -pl examples/spring clean test -DbrowserName=iphone -Dmobile.simulator=false -DuseHub=true -DgridUrl=${{ secrets.BROWSER_STACK_URL }}

android:
if: github.event.pull_request.head.repo.full_name == github.repository
needs: [ check-env ]
if: needs.check-env.outputs.browserStackUrl-available == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down

0 comments on commit 323228b

Please sign in to comment.