forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (87 loc) · 3.17 KB
/
Copy pathexternal-pr-weekly-digest.yml
File metadata and controls
98 lines (87 loc) · 3.17 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
name: External PR Weekly Digest
on:
schedule:
- cron: '0 9 * * 1'
workflow_dispatch:
inputs:
stale_days:
description: 'Number of days without activity to consider PR stale'
required: false
type: number
default: 30
dry_run:
description: 'Dry run mode (print report but skip Slack notification)'
required: false
type: boolean
default: false
team_filter:
description: 'Filter to specific team (leave empty for all)'
required: false
type: string
permissions:
contents: read
pull-requests: read
id-token: write
env:
STALE_THRESHOLD_DAYS: ${{ inputs.stale_days || 30 }}
jobs:
report:
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'workflow_dispatch' && 'manual-trigger' || '' }}
steps:
- name: Validate manual trigger
if: github.event_name == 'workflow_dispatch'
env:
ACTOR: ${{ github.actor }}
TEAM_FILTER: ${{ inputs.team_filter }}
run: |
echo "::notice::Manual trigger by $ACTOR"
if [ -n "$TEAM_FILTER" ]; then
echo "::notice::Team filter: $TEAM_FILTER"
else
echo "::notice::No team filter - will process all enabled teams"
fi
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
sparse-checkout: |
.github/team-notifications-config.json
.github/CODEOWNERS
.github/workflows/scripts/utils.mts
.github/workflows/scripts/pr-digest.mts
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: '22'
- name: Get vault secrets
id: vault-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@c2f1df59dba624b3fd509e5181aa8da5217120c0 # main
with:
repo_secrets: |
OPENAI_API_KEY=community-openai:key
SLACK_BOT_TOKEN=community-slack-bot:token
SLACK_CHANNELS=community-slack-channels:map
- name: Get all PRs
id: fetch-prs
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: node --experimental-strip-types .github/workflows/scripts/pr-digest.mts fetch
- name: Process teams and send reports
if: steps.fetch-prs.outputs.external_prs == 'true'
env:
GH_TOKEN: ${{ github.token }}
OPENAI_API_KEY: ${{ env.OPENAI_API_KEY }}
STALE_DAYS: ${{ env.STALE_THRESHOLD_DAYS }}
REPO: ${{ github.repository }}
DATA_FILE: ${{ steps.fetch-prs.outputs.data_file }}
DRY_RUN: ${{ inputs.dry_run || 'false' }}
TEAM_FILTER: ${{ inputs.team_filter || '' }}
SLACK_BOT_TOKEN: ${{ env.SLACK_BOT_TOKEN }}
run: node --experimental-strip-types .github/workflows/scripts/pr-digest.mts process
- name: No PRs summary
if: steps.fetch-prs.outputs.external_prs != 'true'
run: |
echo "No open external PRs found."
echo "Skipping Slack notification."