Skip to content

Commit a1154b4

Browse files
authored
feat(ci): add helpful error when check-generated-code gha workflow fails (#627)
* feat(ci): add helpful error when check-generated-code gha workflow fails * fixup from review, more explicit steps * fixup from review, stop using .bash suffix and better handle GITHUB_ACTIONS env * fixup further enhance error message for actionable instructions * fixup more reasonable bash opts order, o pipefail belongs together * fixup i'm glad for slow openshift-ci that helped me realize I forgot to finish the shell script renaming
1 parent cdbf086 commit a1154b4

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

.github/workflows/build-notebooks-TEMPLATE.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
df -h
7070
free -h
7171
72-
bash ./ci/cached-builds/gha_lvm_overlay.bash
72+
bash ./ci/cached-builds/gha_lvm_overlay.sh
7373
7474
df -h
7575
free -h

.github/workflows/code-quality.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ jobs:
1515
- uses: actions/checkout@v4
1616

1717
- name: Rerun all code generators we have
18-
run: python3 ci/cached-builds/gen_gha_matrix_jobs.py
18+
run: bash ci/generate_code.sh
1919

2020
- name: Check there aren't any modified files present
2121
run: |
2222
clean=$(git status --porcelain)
2323
if [[ -z "$clean" ]]; then
2424
echo "Empty git status --porcelain: $clean"
2525
else
26+
echo "::error::Please run 'bash ci/generate_code.sh' (the command from the previous step), commit the changed files locally, and push again."
2627
echo "Uncommitted file changes detected: $clean"
2728
git diff
2829
exit 1

ci/cached-builds/gen_gha_matrix_jobs.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,13 @@ def main() -> None:
175175

176176
print("leafs", leafs)
177177
print(*output, sep="\n")
178-
with open(os.environ["GITHUB_OUTPUT"], "at") as f:
179-
for line in output:
180-
print(line, file=f)
178+
179+
if "GITHUB_ACTIONS" in os.environ:
180+
with open(os.environ["GITHUB_OUTPUT"], "at") as f:
181+
for line in output:
182+
print(line, file=f)
183+
else:
184+
logging.info(f"Not running on Github Actions, won't produce GITHUB_OUTPUT")
181185

182186

183187
if __name__ == '__main__':

ci/generate_code.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -Eeuxo pipefail
3+
4+
python3 ci/cached-builds/gen_gha_matrix_jobs.py

0 commit comments

Comments
 (0)