-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuggest-cron-pr.yml
More file actions
36 lines (32 loc) · 1.15 KB
/
Copy pathsuggest-cron-pr.yml
File metadata and controls
36 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Auto-PR: shift a workflow's schedule to the grid's cleanest hour
#
# Runs weekly, finds the cleanest hour for your zone (from accumulated history,
# else forecast, else heuristic), and opens a PR moving the target workflow's
# daily cron to that hour. You review and merge — the saving then applies to
# every future run, with no idle waiting.
#
# Only simple daily crons are rewritten; cadence and minute are preserved.
#
# Copy to .github/workflows/carbon-suggest-cron.yml
name: Carbon-Aware Schedule Suggestion
on:
schedule:
- cron: "0 9 * * 1" # Mondays 09:00 UTC
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
suggest:
runs-on: ubuntu-latest
steps:
- uses: peterklingelhofer/carbon-aware-dispatcher@v1
with:
mode: "suggest"
grid_zones: "GB"
suggest_target: ".github/workflows/nightly-batch.yml"
github_token: ${{ secrets.GITHUB_TOKEN }}
# Optional: feed the accumulating curve from a ledger so non-GB zones
# build a profile over time.
# ledger: 'gist:${{ vars.CARBON_LEDGER_GIST }}'
# gist_token: ${{ secrets.GIST_TOKEN }}