Start Renovate in ygg/deployments after a release
Renovate only runs at 03:00 UTC, so a release waited up to a day for its deploy PR. Dispatch renovate.yml right after the image is pushed. It needs DEPLOYMENTS_DISPATCH_TOKEN (the job token can't dispatch in another repo); when that is missing or the call fails, it warns and the release still succeeds, since the image is already pushed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
08c2b1b286
commit
1ff73f8b20
1 file changed
+27
@@ -30,3 +30,30 @@ jobs:
|
||||
DIGEST: ${{ steps.image.outputs.digest }}
|
||||
run: |
|
||||
printf 'tags: %s\ndigest: %s\n' "$TAGS" "$DIGEST"
|
||||
|
||||
# Renovate in ygg/deployments otherwise only runs at 03:00 UTC, so
|
||||
# start it now to open the deploy PR within minutes. The job token
|
||||
# can't dispatch in another repo, so this needs a token with
|
||||
# write:repository from an account with write access to ygg/deployments.
|
||||
# The image is already pushed: anything going wrong here is a warning,
|
||||
# never a failed release.
|
||||
- name: Start Renovate in ygg/deployments
|
||||
env:
|
||||
TOKEN: ${{ secrets.DEPLOYMENTS_DISPATCH_TOKEN }}
|
||||
API: ${{ gitea.api_url }}
|
||||
run: |
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "::warning::DEPLOYMENTS_DISPATCH_TOKEN is not set; Renovate opens the deploy PR at its next 03:00 UTC run"
|
||||
exit 0
|
||||
fi
|
||||
body=$(mktemp)
|
||||
code=$(curl -sS --max-time 30 -o "$body" -w '%{http_code}' -X POST \
|
||||
-H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
|
||||
-d '{"ref":"main"}' \
|
||||
"$API/repos/ygg/deployments/actions/workflows/renovate.yml/dispatches") || code="curl failed"
|
||||
if [ "$code" = 204 ]; then
|
||||
echo "Renovate started: https://git.app.ygg/ygg/deployments/actions?workflow=renovate.yml"
|
||||
else
|
||||
echo "::warning::Could not start Renovate in ygg/deployments ($code): $(head -c 300 "$body")"
|
||||
fi
|
||||
rm -f "$body"
|
||||
Reference in new issue
Block a user