-
Notifications
You must be signed in to change notification settings - Fork 4.9k
90 lines (84 loc) · 3.31 KB
/
Copy pathapi-diff-orchestrator.yml
File metadata and controls
90 lines (84 loc) · 3.31 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: API Diff Orchestrator
# Orchestration only: evaluate the dnceng NuGet feeds to discover the active,
# not-yet-shipped release milestones and dispatch one API Diff run per
# milestone. Deterministic discovery (no agent), so this is a plain workflow.
# The API Diff Worker workflow is invoked as a reusable workflow (workflow_call) so it
# runs in this run's context and inherits the orchestrator's actor, satisfying its
# gh-aw activation role check.
on:
schedule:
- cron: "17 13 * * *" # daily, ~06:17 PT
workflow_dispatch:
inputs:
dry_run:
description: "Dry-Run: Compute and print targets without dispatching workers."
required: false
type: boolean
default: false
permissions:
contents: read
concurrency:
group: api-diff-orchestrator
cancel-in-progress: false
jobs:
discover:
name: Discover milestones
if: ${{ github.event_name == 'workflow_dispatch' || !github.event.repository.fork }}
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.discover.outputs.targets }}
count: ${{ steps.discover.outputs.count }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup .NET
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
with:
dotnet-version: "10.0.x"
- name: Discover API diff milestones from the NuGet feeds
id: discover
run: |
set -euo pipefail
# The C# app writes the JSON array to this file so the "dotnet run"
# build/restore output on stdout never contaminates the captured value.
out="${RUNNER_TEMP}/api-diff-targets.json"
dotnet run .github/scripts/api-diff-discover.cs -- "$out"
targets="$(cat "$out")"
count="$(jq 'length' <<<"$targets")"
echo "Discovered ${count} milestone target(s):"
jq '.' <<<"$targets"
{
echo "targets<<__EOF__"; jq -c '.' <<<"$targets"; echo "__EOF__"
echo "count=${count}"
} >> "$GITHUB_OUTPUT"
{
echo "## Discovered ${count} API diff milestone(s)"
echo '```json'; jq '.' <<<"$targets"; echo '```'
} >> "$GITHUB_STEP_SUMMARY"
api_diff:
name: API Diff
needs: discover
if: ${{ needs.discover.outputs.count != '0' && !inputs.dry_run }}
permissions:
contents: write
pull-requests: write
issues: write
actions: read
packages: read
strategy:
fail-fast: false
# Workers share one concurrency group ("gh-aw-<workflow>", cancel-in-progress
# false), so distinct targets serialize regardless of this value. Dispatch them
# one at a time so a queued target is never dropped by concurrency's
# pending-run-replacement rule.
max-parallel: 1
matrix:
target: ${{ fromJSON(needs.discover.outputs.targets) }}
# Invoke the API Diff Worker workflow via workflow_call so it runs in this
# run's context and inherits the orchestrator's actor, satisfying its gh-aw role
# check. (A GITHUB_TOKEN workflow_dispatch would run as github-actions[bot],
# which has no repo role and fails activation.)
uses: ./.github/workflows/api-diff-worker.lock.yml
with:
target: ${{ toJSON(matrix.target) }}
secrets: inherit