Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented condition at entry point of workflow #590

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/shared_matrix_prep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
type: string
run_if:
description: 'True to get configuration matrix'
default: false
required: true
default: true
required: false
type: boolean
outputs:
matrix:
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/shared_setup_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: setup_env

on:
workflow_call:
inputs:
run_if:
description: 'True if workflow needs to run'
default: false
required: true
type: boolean
outputs:
nightly:
description: 'True if workflow triggered by nightly, else False'
Expand All @@ -13,13 +19,18 @@ on:
jobs:
config:
runs-on: ubuntu-22.04
if: ${{ (github.event.schedule && github.event.repository.private) == false }}
if: ${{ inputs.run_if }}
outputs:
nightly: ${{ steps.config.outputs.nightly }}
retention_days: ${{ steps.config.outputs.retention_days }}
steps:
- name: check condition status
run : |
echo ${{ github.event.schedule }}
echo ${{ github.event.repository.private }}
echo ${{ (github.event.schedule && github.event.repository.private) == false }}
- name: Check Nightly/Scheduled
id: config
run: |
echo "nightly=$(echo '${{ (github.event.schedule && (!github.event.repository.private)) && 'true' || 'false' }}')" >> $GITHUB_OUTPUT
echo "retention_days=$(echo '${{ (github.event.schedule && (!github.event.repository.private)) && '7' || '1' }}')" >> $GITHUB_OUTPUT
echo "nightly=$(echo '${{ ((github.event.schedule != '') && (!github.event.repository.private)) && 'true' || 'false' }}')" >> $GITHUB_OUTPUT
echo "retention_days=$(echo '${{ ((github.event.schedule != '') && (!github.event.repository.private)) && '7' || '1' }}')" >> $GITHUB_OUTPUT