green_master.yaml 984 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ---
  2. name: Keep master green
  3. on:
  4. schedule:
  5. # run hourly
  6. - cron: "0 * * * *"
  7. workflow_dispatch:
  8. permissions:
  9. contents: read
  10. jobs:
  11. rerun-failed-jobs:
  12. if: github.repository_owner == 'emqx'
  13. runs-on: ubuntu-latest
  14. permissions:
  15. checks: read
  16. actions: write
  17. strategy:
  18. fail-fast: false
  19. matrix:
  20. ref:
  21. - master
  22. - release-58
  23. steps:
  24. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  25. with:
  26. ref: ${{ matrix.ref }}
  27. - name: run script
  28. shell: bash
  29. env:
  30. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  31. GITHUB_REPO: ${{ github.repository }}
  32. run: |
  33. for id in $(gh run list --branch ${{ matrix.ref }} --workflow "Push Entrypoint" --commit $(git rev-parse HEAD) --status failure --json databaseId,attempt --jq '.[] | select(.attempt < 3) | .databaseId'); do
  34. gh run rerun "$id" --failed
  35. done