This commit is contained in:
@@ -8,11 +8,16 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
health-check:
|
health-check:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
|
||||||
image: alpine:3.20
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: apk add --no-cache curl docker-cli grep
|
run: |
|
||||||
|
if command -v apk >/dev/null 2>&1; then
|
||||||
|
apk add --no-cache curl grep
|
||||||
|
elif command -v apt-get >/dev/null 2>&1; then
|
||||||
|
apt-get update -qq && apt-get install -y -qq curl grep
|
||||||
|
else
|
||||||
|
echo "No supported package manager"; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Check Gitea health
|
- name: Check Gitea health
|
||||||
id: gitea
|
id: gitea
|
||||||
@@ -48,22 +53,9 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Cleanup stale action containers
|
|
||||||
id: cleanup
|
|
||||||
run: |
|
|
||||||
REMOVED=0
|
|
||||||
for cid in $(docker ps -a --filter "label=org.opencontainers.image.source=gitea/act_runner" -q 2>/dev/null || true); do
|
|
||||||
STATE=$(docker inspect -f '{{.State.Status}}' "$cid" 2>/dev/null || echo unknown)
|
|
||||||
if [ "$STATE" = "exited" ]; then
|
|
||||||
docker rm "$cid" >/dev/null 2>&1 && REMOVED=$((REMOVED+1)) || true
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "result=ok|清理 ${REMOVED} 个已退出的 job 容器" >> $GITHUB_OUTPUT
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Notify DingTalk on failure
|
- name: Notify DingTalk on failure
|
||||||
if: failure()
|
if: failure()
|
||||||
run: |
|
run: |
|
||||||
curl -s -X POST "https://oapi.dingtalk.com/robot/send?access_token=${{ secrets.DINGDING_TOKEN }}" \
|
curl -s -X POST "https://oapi.dingtalk.com/robot/send?access_token=${{ secrets.DINGDING_TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"msgtype":"markdown","markdown":{"title":"❌ Gitea Runner 自主维护告警 chen-fnos","text":"## ❌ Gitea Runner 自主维护告警 chen-fnos\n\n- Gitea: ${{ steps.gitea.outputs.result }}\n- Verdaccio: ${{ steps.verdaccio.outputs.result }}\n- Runner: ${{ steps.runner.outputs.result }}\n- 清理: ${{ steps.cleanup.outputs.result }}\n\n请检查 gitea-runner 容器状态"}}'
|
-d '{"msgtype":"markdown","markdown":{"title":"❌ Gitea Runner 自主维护告警 chen-fnos","text":"## ❌ Gitea Runner 自主维护告警 chen-fnos\n\n- Gitea: ${{ steps.gitea.outputs.result }}\n- Verdaccio: ${{ steps.verdaccio.outputs.result }}\n- Runner: ${{ steps.runner.outputs.result }}\n\n请检查 gitea-runner 容器状态"}}'
|
||||||
|
|||||||
Reference in New Issue
Block a user