Use strings.IsFalsy to wrap vars that can be 'none' or empty #995
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GUIChecks | |
on: | |
pull_request: | |
paths: | |
- 'tasks/*' | |
- 'workflows/*' | |
push: | |
branches: | |
- 'master' | |
env: | |
LIST_OF_VARIABLES: \[-trg_global_run_enabled:-\]\[-dcs_enabled:-\]\|\[-trg_enabled:-\]\|\[-epn_enabled:-\]\|\[-odc_topology:-\]\|\[-odc_enabled:-\]\|\[-qcdd_enabled:-\]\|\[-dd_enabled:-\]\|\[-ddsched_enabled:-\]\|\[-minimal_dpl_enabled:-\]\|\[-readout_cfg_uri:-\]\|\[-qc_config_uri:-\]|\[-pdp_config_option:-\]|\[-pdp_o2_data_processing_hash:-\]|\[-pdp_topology_description_library_file:-\]|\[-pdp_workflow_name:-\]|\[-pdp_o2_data_processing_path:-\] | |
jobs: | |
directories-check: | |
name: Checks no changes are done to fix variables in workflows or tasks directory | |
runs-on: macOS-latest | |
env: | |
RESULT_WORKFLOWS: '' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
path: ControlWorkflows | |
- run: (echo "Changes are coming from commit ${{ github.event.pull_request.base.sha }} ") | |
- run: (echo "Checks will be ran against commit ${{ github.sha }}") | |
- name: Run GUI variables checks for differences | |
working-directory: ./ControlWorkflows | |
run: | | |
git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -U0 --word-diff > workflow_changes.txt | |
RESULT_WORKFLOWS=$(grep "${{env.LIST_OF_VARIABLES}}" workflow_changes.txt) || true | |
# grep command returns exit code != 0 if it fails to find a match, thus we use || true | |
if [ -z "$RESULT_WORKFLOWS" ]; | |
then | |
echo "WORKFLOWS/TASKS folder did not find any breaking changes" | |
else | |
echo "------------------" | |
echo "Identified keys that were changed:" | |
echo $RESULT_WORKFLOWS | |
echo "------------------" | |
echo "WORKFLOWS/TASKS folder found breaking changes. Please inform GUI Developer" | |
exit 1 | |
fi |