Spaces:
Running
Running
Commit
·
bc16516
1
Parent(s):
5fc9f7f
Workflow to ensure codebase integrity
Browse files
.github/workflows/restore_cost_benefit.yml
CHANGED
@@ -75,16 +75,18 @@ jobs:
|
|
75 |
}
|
76 |
PY
|
77 |
|
78 |
-
|
79 |
-
- name: Commit & push if the file changed
|
80 |
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
81 |
run: |
|
|
|
82 |
git config user.name "github-actions"
|
83 |
git config user.email "github-actions@github.com"
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
87 |
git push origin HEAD:main
|
88 |
else
|
89 |
-
echo "
|
90 |
fi
|
|
|
75 |
}
|
76 |
PY
|
77 |
|
78 |
+
- name: Commit & push only when the file was missing
|
|
|
79 |
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
80 |
run: |
|
81 |
+
set -e
|
82 |
git config user.name "github-actions"
|
83 |
git config user.email "github-actions@github.com"
|
84 |
+
|
85 |
+
# If the file is NOT in the current Git index, add‑commit‑push.
|
86 |
+
if ! git ls-files --error-unmatch src/cost_benefit.py >/dev/null 2>&1; then
|
87 |
+
git add src/cost_benefit.py
|
88 |
+
git commit -m "chore(ci): restore missing src/cost_benefit.py [skip ci]"
|
89 |
git push origin HEAD:main
|
90 |
else
|
91 |
+
echo "src/cost_benefit.py already exists in the repository – nothing to restore"
|
92 |
fi
|