fix(workflow): treat fork-sync rc=2 as success-with-changes

fork-sync.py exits with code 2 when it has alerts to report (changes
detected) and 1 on real errors. The workflow was treating any non-empty
output as a failure, which made every run where branches were created
show up as failure in CI even though everything worked correctly.

Workflow now distinguishes:
  rc=0: nothing to report
  rc=2: changes reported (success, but worth surfacing in CI summary)
  rc>=3 or other: real failure, mark as such

Assisted-By: hermes-agent:minimax-m3
This commit is contained in:
hermes
2026-09-14 17:10:16 +00:00
parent bd96dba9a1
commit a63f8f3f9c
2 changed files with 11 additions and 6 deletions
+10 -6
View File
@@ -27,11 +27,15 @@ jobs:
GITEA_TOKEN: ${{ secrets.HERMES_GITEA_TOKEN }}
WORK_ROOT: ${{ github.workspace }}/work
run: |
python tools/fork-sync.py > out.txt 2>&1 || true
set +e
python tools/fork-sync.py > out.txt 2>&1
rc=$?
set -e
echo "::group::fork-sync output"
cat out.txt
if [ -s out.txt ]; then
echo "::group::fork-sync output"
cat out.txt
echo "::endgroup::"
exit 1
echo "::endgroup::"
echo "fork-sync rc=$rc"
if [ $rc -ne 0 ] && [ $rc -ne 2 ]; then
echo "::error::fork-sync failed with rc=$rc"
exit $rc
fi
+1
View File
@@ -176,6 +176,7 @@ def main():
if not alerts:
return
print("\n".join(alerts))
sys.exit(2) # 2 = changes reported, distinct from 1 = real error
if __name__ == "__main__":