Skip to content

Commit c04d81a

Browse files
authored
chore: checklist workflow: Proceed conditionally (#992)
Only generate XLS, etc if the json changes. Signed-off-by: kingthorin <[email protected]>
1 parent 4e4770b commit c04d81a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/build-checklists.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,26 @@ jobs:
2929
run: |
3030
sudo apt update
3131
sudo apt install moreutils
32-
- name: Run JSON Build
32+
- name: |
33+
npm run-script jsongen
34+
git update-index -q --refresh
35+
if ! git diff-index --quiet HEAD --; then
36+
echo "CHANGED=true" >> $GITHUB_ENV
37+
fi
3338
run: npm run-script jsongen
3439
- name: Setup Python
40+
if: env.CHANGED == 'true'
3541
uses: actions/setup-python@v4
3642
with:
3743
python-version: "3.10"
3844
- name: Install Dependencies
3945
run: |
4046
pip install openpyxl
4147
- name: Run XLSX Build
48+
if: env.CHANGED == 'true'
4249
run: npm run-script xlsxgen
4350
- name: Git Setup Global Config
51+
if: env.CHANGED == 'true'
4452
run: |
4553
# Git setup
4654
export GITHUB_USER=wstgbot
@@ -49,16 +57,19 @@ jobs:
4957
git config --global user.email "[email protected]"
5058
git config --global user.name $GITHUB_USER
5159
- name: Setup Environment Variables
60+
if: env.CHANGED == 'true'
5261
run : |
5362
# Setup some env vars etc for future use
5463
echo "SRC_BASE="OWASP/wstg@"$(git log -1 --format=format:%h)" >> $GITHUB_ENV
5564
echo "BRANCH_STAMP=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_ENV
5665
echo "SHORT_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
5766
- name: Create Feature Branch
67+
if: env.CHANGED == 'true'
5868
run: |
5969
# Checkout what will be the new feature branch
6070
git checkout -b $BRANCH_STAMP
6171
- name: Push Feature Branch and Raise PR
72+
if: env.CHANGED == 'true'
6273
run: |
6374
# If there are changes: add, commit, PR
6475
git add checklists/

0 commit comments

Comments
 (0)