pug icon indicating copy to clipboard operation
pug copied to clipboard

buf-ci turns all of Leo's scheduled workflows back on, not just the proto sync

Open poluruprvn opened this issue 6 days ago • 0 comments

GitHub turns off a public repo's scheduled workflows after 60 days with no activity. All of Leo's (pug-sh/leo) go off together, so none of them can turn the others back on, and pug's buf-ci.yaml does it instead: its leo job turns Leo's inbox.yml and protos.yml back on after the BSR push, then starts protos.yml. devices.yml, Leo's new weekly device-name sync, joins the list once Leo has it.

Only protos.yml follows from the BSR push, and keeping the rest in buf-ci has three problems. The list of Leo's scheduled workflows is kept by hand in pug, and it already misses osv-scanner.yml, which runs hourly, so that one stays off after a quiet 60 days. Each new scheduled workflow in Leo needs a pug change that can only land once Leo's main has it: enabling a workflow Leo doesn't have fails the step, and then the job never starts protos.yml. And since the job needs buf, a failed BSR push leaves Leo off until a later push gets through.

Cause: the leo job is the one job in pug that holds a token for Leo, so the enable calls went there.

How to solve it

Leave only protos.yml in buf-ci, and turn the others back on by their state instead of from a list. GitHub marks a workflow it turned off disabled_inactivity, and one a person turned off disabled_manually, which should stay off.

The simplest place is Leo's protos.yml, the workflow buf-ci starts, with a job that uses the workflow's own token:

  # GitHub turns off all of a public repo's scheduled workflows after 60 days with no activity.
  # pug's buf-ci turns this one back on to start it, and this job turns the rest back on. One that
  # a person turned off stays off.
  wake:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    permissions:
      actions: write
    steps:
      - env:
          GH_TOKEN: ${{ github.token }}
        shell: bash
        run: |
          gh api --paginate "repos/$GITHUB_REPOSITORY/actions/workflows" \
            --jq '.workflows[] | select(.state == "disabled_inactivity") | "\(.id) \(.path)"' |
            while read -r id path; do
              echo "Turning $path back on"
              gh api --method PUT "repos/$GITHUB_REPOSITORY/actions/workflows/$id/enable"
            done

That still waits on a BSR push that gets through. If that matters, run the same step in a small workflow of its own in pug, on every push to main, with the Leo App token instead.

The filter has been tried on the API's output, but the job hasn't run on GitHub, so check that a GITHUB_TOKEN with actions: write may call the enable endpoint.

poluruprvn avatar Nov 30 '26 05:11 poluruprvn