forked from Open-CMSIS-Pack/devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (34 loc) · 1.28 KB
/
shared_setup_env.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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'
value: ${{ jobs.config.outputs.nightly }}
retention_days:
description: 'Artifact retention days 7 when nightly, else 1'
value: ${{ jobs.config.outputs.retention_days }}
jobs:
config:
runs-on: ubuntu-22.04
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