Repository navigation
Expand file tree
/
Copy pathpull-request-dashboard-drain.yml
More file actions
85 lines (81 loc) · 3.68 KB
/
Copy pathpull-request-dashboard-drain.yml
File metadata and controls
85 lines (81 loc) · 3.68 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
name: Pull request dashboard queue drain
run-name: Pull request dashboard ${{ inputs.queue_lane || 'live' }} queue drain
on:
workflow_dispatch:
inputs:
dispatcher_generation:
description: Netlify queue dispatcher generation.
required: true
type: string
queue_lane:
description: Independent queue lane to drain.
required: true
default: live
type: choice
options:
- live
- maintenance
permissions: {}
jobs:
owned-drain:
if: github.repository == 'open-telemetry/shared-workflows' && vars.PR_DASHBOARD_EXECUTION_MODE == 'owned'
permissions:
contents: write
copilot-requests: write
id-token: write
environment: protected
runs-on: ubuntu-latest
timeout-minutes: 50
env:
DISPATCHER_GENERATION: ${{ inputs.dispatcher_generation }}
PR_DASHBOARD_QUEUE_LANE: ${{ inputs.queue_lane || 'live' }}
PR_DASHBOARD_QUEUE_ENDPOINT: https://otel-pull-request-dashboard.netlify.app/.netlify/functions/dashboard-queue-worker
WORKER_ID: ${{ github.run_id }}-${{ github.run_attempt }}
CANARY_REPOSITORIES: '["opentelemetry-java-instrumentation", "shared-workflows"]'
CANARY_CODE_REF: ${{ github.sha }}
PR_DASHBOARD_CLASSIFICATION_CACHE_ROOT: ${{ github.workspace }}/.github/scripts/pull-request-dashboard/.cache/classifications
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
package-manager-cache: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.15'
- name: Install worker dependencies
run: |
npm ci --prefix .github/scripts/pull-request-dashboard
mkdir -p .github/scripts/pull-request-dashboard/.cache/classifications
- name: Restore classification cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .github/scripts/pull-request-dashboard/.cache/classifications
key: pull-request-dashboard-classifications-owned-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: pull-request-dashboard-classifications-owned-
- name: Process owned queue work
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COPILOT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COPILOT_REVIEW_FALLBACK_TOKEN: ${{ secrets.COPILOT_REVIEW_FALLBACK_TOKEN }}
PR_DASHBOARD_CLIENT_ID: ${{ vars.PR_DASHBOARD_CLIENT_ID }}
PR_DASHBOARD_PRIVATE_KEY: ${{ secrets.PR_DASHBOARD_PRIVATE_KEY }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
set -euo pipefail
[[ "$DISPATCHER_GENERATION" =~ ^[1-9][0-9]*$ ]] || { echo "bad dispatcher generation"; exit 1; }
python3 .github/scripts/pull-request-dashboard/drain_queue.py \
--deadline "$(($(date +%s) + 40 * 60))" \
--generation "$DISPATCHER_GENERATION" \
--worker "$WORKER_ID" \
--endpoint "$PR_DASHBOARD_QUEUE_ENDPOINT" \
--canary-code-ref "$CANARY_CODE_REF" \
--canary-repositories-json "$CANARY_REPOSITORIES"
- name: Save classification cache
if: always()
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .github/scripts/pull-request-dashboard/.cache/classifications
key: pull-request-dashboard-classifications-owned-${{ github.run_id }}-${{ github.run_attempt }}