Repository navigation
70 lines (65 loc) · 2.61 KB
/
Copy pathinfra-activity.yml
File metadata and controls
70 lines (65 loc) · 2.61 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Manages the infra/* labels on Infrastructure Request issues, as defined in
# KEP-939 (proposals/939-oci-infrastructure-management/README.md):
#
# infra/needs-allocation -> applied by the issue template on creation
# infra/allocated -> applied by an admin once resources are provisioned
# infra/timeline-120d/90d/60d/30d/expired -> remaining-lease buckets
#
# Three jobs:
# * on `issues: opened` — for issues created from the Infrastructure Request
# form, create the infra/* labels if they do not exist yet and apply
# infra/needs-allocation (issue forms only apply labels that already exist).
# * on `issues: labeled` — keep labels consistent: a timeline label removes
# any other timeline label (they are mutually exclusive), and
# infra/allocated removes infra/needs-allocation.
# * on a daily cron — for every open issue carrying infra/allocated and a
# timeline label, check when the current timeline label was applied and
# downgrade it once the bucket has elapsed (120d -> 90d -> 60d -> 30d ->
# expired), posting a reminder comment mentioning the PoC at each step.
#
# Optional repository variable INFRA_ADMINS (e.g. "@alice @bob") is mentioned
# when a lease expires.
name: Infra activity
on:
schedule:
- cron: '30 0 * * *' # Daily at 00:30 UTC
issues:
types: [opened, labeled]
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
intake:
if: github.event_name == 'issues' && github.event.action == 'opened'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
with:
script: |
const run = require('./.github/scripts/infra-activity.js');
await run.intake({ github, context, core });
sync-labels:
if: github.event_name == 'issues' && github.event.action == 'labeled' && startsWith(github.event.label.name, 'infra/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
with:
script: |
const run = require('./.github/scripts/infra-activity.js');
await run.syncLabels({ github, context, core });
timeline-countdown:
if: github.event_name != 'issues'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
env:
INFRA_ADMINS: ${{ vars.INFRA_ADMINS }}
with:
script: |
const run = require('./.github/scripts/infra-activity.js');
await run.ensureLabels({ github, context, core });
await run.timelineCountdown({ github, context, core });