Repository navigation
Expand file tree
/
Copy pathpull-request-dashboard-refresh-author-nudges.yml
More file actions
135 lines (125 loc) · 4.8 KB
/
Copy pathpull-request-dashboard-refresh-author-nudges.yml
File metadata and controls
135 lines (125 loc) · 4.8 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Pull request dashboard author reminder sweep
# The dashboard collapses an author reminder from its own state, so a reminder
# whose state entry was lost stays visible forever. This sweep reads the pull
# request instead of the state, collapsing reminders the dashboard can no longer
# reach and rewriting live ones whose wording has since changed. It is run by
# hand; nothing schedules it.
on:
workflow_dispatch:
inputs:
repository:
description: Target repository. Empty means all configured repositories.
required: false
type: string
dry_run:
description: Report what would change without writing to GitHub.
required: false
default: true
type: boolean
permissions: {}
env:
DASHBOARD_CONFIG: .github/scripts/pull-request-dashboard/repositories.json
DASHBOARD_STATE_BRANCH_PREFIX: otelbot/pull-request-dashboard-state
jobs:
enqueue:
if: github.repository == 'open-telemetry/shared-workflows' && inputs.dry_run == false
runs-on: ubuntu-latest
environment: protected
permissions:
contents: read
id-token: write
env:
TARGET_REPOSITORY: ${{ inputs.repository }}
PR_DASHBOARD_QUEUE_ENDPOINT: https://otel-pull-request-dashboard.netlify.app/.netlify/functions/dashboard-queue-worker
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Accept author reminder sweep
env:
OTEL_GITHUB_STEP_NAME: Accept author reminder sweep
OTEL_GITHUB_CHECK_RUN_ID: ${{ job.check_run_id }}
run: |
export TRACEPARENT="$(bash .github/scripts/pull-request-dashboard/github_traceparent.sh)"
python3 .github/scripts/pull-request-dashboard/enqueue_dashboard.py --reminders
resolve-targets:
if: >-
github.repository == 'open-telemetry/shared-workflows' &&
inputs.dry_run
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.targets.outputs.matrix }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Resolve target repositories
id: targets
env:
TARGET_REPOSITORY: ${{ inputs.repository }}
run: |
set -euo pipefail
selected=$(jq -c --arg repo "$TARGET_REPOSITORY" '
if $repo == "" then
.
else
[ .[] | select(.name == $repo) ]
end
| [ .[] | {name} ]
' "$DASHBOARD_CONFIG")
if [[ "$selected" == "[]" ]]; then
echo "no configured repository matched: ${TARGET_REPOSITORY:-<all>}" >&2
exit 1
fi
echo "matrix={\"include\":${selected}}" >> "$GITHUB_OUTPUT"
jq '[ .[].name ]' <<< "$selected"
sweep:
needs: resolve-targets
concurrency:
group: pull-request-dashboard-dry-run-${{ github.run_id }}-${{ matrix.name }}
cancel-in-progress: false
strategy:
fail-fast: false
max-parallel: 4
matrix: ${{ fromJSON(needs.resolve-targets.outputs.matrix) }}
permissions:
contents: read
environment: protected
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
id: dashboard-token
with:
client-id: ${{ vars.PR_DASHBOARD_CLIENT_ID }}
private-key: ${{ secrets.PR_DASHBOARD_PRIVATE_KEY }}
owner: open-telemetry
repositories: ${{ matrix.name }}
permission-issues: read
permission-pull-requests: read
- name: Refresh author reminders
env:
GH_TOKEN: ${{ steps.dashboard-token.outputs.token }}
TARGET_REPOSITORY: ${{ matrix.name }}
OTEL_GITHUB_STEP_NAME: Refresh author reminders
OTEL_GITHUB_CHECK_RUN_ID: ${{ job.check_run_id }}
working-directory: .github/scripts/pull-request-dashboard
run: |
set -euo pipefail
export TRACEPARENT="$(bash github_traceparent.sh)"
python3 refresh_author_nudges.py --repo "$TARGET_REPOSITORY" --dry-run
- name: Report GitHub App rate limits
if: always()
continue-on-error: true
env:
GH_TOKEN: ${{ steps.dashboard-token.outputs.token }}
OTEL_GITHUB_STEP_NAME: Report GitHub App rate limits
OTEL_GITHUB_CHECK_RUN_ID: ${{ job.check_run_id }}
run: |
export TRACEPARENT="$(bash .github/scripts/pull-request-dashboard/github_traceparent.sh)"
python3 .github/scripts/pull-request-dashboard/report_rate_limits.py