Skip to content

Commit eb47b36

Browse files
committed
TEMP probe: continue-on-error vs failure()
1 parent 62d4c66 commit eb47b36

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

.github/workflows/sync-upstream-version.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ jobs:
2525
- name: Checkout
2626
uses: actions/checkout@v7
2727

28+
- name: TEMP failing step with continue-on-error
29+
continue-on-error: true
30+
run: exit 1
31+
32+
- name: TEMP does failure() fire
33+
if: failure()
34+
run: echo "FAILURE-CONTEXT-FIRED"
35+
2836
- name: Fetch latest upstream release
2937
id: upstream
3038
run: |
@@ -141,6 +149,11 @@ jobs:
141149
# as JSON.
142150
- name: Announce the new upstream release
143151
if: steps.upstream.outputs.changed == 'true' && env.DISCORD_CONFIGURED == 'true'
152+
# The pin has moved and the PR is open by this point, so a webhook that
153+
# rejects us is not a failed sync. It also must not reach the failure
154+
# notifier below, which posts to this same webhook and would fail the
155+
# same way.
156+
continue-on-error: true
144157
env:
145158
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
146159
UPSTREAM_TAG: ${{ steps.upstream.outputs.tag }}
@@ -150,15 +163,21 @@ jobs:
150163
set -euo pipefail
151164
summary=""
152165
if [ -f reports/parity_report.md ]; then
153-
summary="$(sed -n '/## Summary/,$p' reports/parity_report.md | head -c 1200)"
166+
# Truncated after capture, not through `head`: closing the pipe
167+
# early sends sed a SIGPIPE, which pipefail turns into a failed
168+
# step once the report outgrows the pipe buffer -- that is, exactly
169+
# when the gap is big enough to be worth announcing.
170+
summary="$(sed -n '/## Summary/,$p' reports/parity_report.md)"
171+
summary="${summary:0:1200}"
154172
fi
155173
if [ -z "$summary" ]; then
156174
summary="Parity report not generated; see the run log."
157175
fi
158176
content="$(printf 'upstream apprise %s is out (pinned: %s).\n%s\n\n%s' \
159177
"$UPSTREAM_TAG" "$PINNED" "${PR_URL:-no sync PR was opened}" "$summary")"
160178
jq -n --arg content "$content" '{content: $content}' \
161-
| curl -sS -X POST -H "Content-Type: application/json" -d @- "$DISCORD_WEBHOOK"
179+
| curl -sS --fail --connect-timeout 10 --max-time 30 \
180+
-X POST -H "Content-Type: application/json" -d @- "$DISCORD_WEBHOOK"
162181
163182
# Without this the checker can break silently and the pin just quietly
164183
# stops moving, which is the failure the checker exists to prevent.
@@ -169,4 +188,5 @@ jobs:
169188
run: |
170189
run_url="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
171190
payload=$(printf '{"content":"upstream version sync failed for %s: %s"}' "$GITHUB_REPOSITORY" "$run_url")
172-
curl -sS -X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK"
191+
curl -sS --fail --connect-timeout 10 --max-time 30 \
192+
-X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK"

0 commit comments

Comments
 (0)