-
Notifications
You must be signed in to change notification settings - Fork 872
85 lines (78 loc) · 4.54 KB
/
gardening.yml
File metadata and controls
85 lines (78 loc) · 4.54 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: Gardening
on:
pull_request_target: # When a PR is opened, edited, updated, closed, or a label is added.
types: [opened, reopened, synchronize, edited, labeled, closed ]
issues: # For auto-triage of issues.
types: [opened, reopened, labeled, edited, closed]
issue_comment: # To gather support references in issue comments.
types: [created]
push:
branches:
- trunk # Every time a PR is merged to trunk.
concurrency:
# For pull_request_target, cancel any concurrent jobs with the same type (e.g. "opened", "labeled") and branch.
# Don't cancel any for other events, accomplished by grouping on the unique run_id.
group: gardening-${{ github.event_name }}-${{ github.event.action }}-${{ case( github.event_name == 'pull_request_target', github.event.pull_request.head.ref, github.run_id ) }}
cancel-in-progress: true
permissions:
# ./.github/actions/turnstile
actions: read
# actions/checkout
contents: read
# ./projects/github-actions/repo-gardening
# read: octokit.rest.issues.listComments, octokit.rest.issues.get, octokit.rest.issues.listLabelsForRepo, octokit.rest.issues.listLabelsOnIssue, octokit.rest.issues.listMilestones
# write: octokit.rest.issues.addAssignees, octokit.rest.issues.addLabels, octokit.rest.issues.createComment, octokit.rest.issues.removeLabel, octokit.rest.issues.update, octokit.rest.issues.updateComment
issues: write
# ./projects/github-actions/repo-gardening
# read: octokit.rest.issues.listComments, octokit.rest.pulls.listFiles, octokit.rest.issues.listLabelsForRepo, octokit.rest.issues.listLabelsOnIssue, octokit.rest.issues.listMilestonesoctokit.rest.issues.listMilestones
# write: octokit.rest.issues.addAssignees, octokit.rest.issues.addLabels, octokit.rest.issues.createComment, octokit.rest.issues.removeLabel, octokit.rest.issues.update, octokit.rest.issues.updateComment
pull-requests: write
jobs:
repo-gardening:
name: "Manage labels and assignees"
runs-on: ubuntu-latest
if: github.event_name == 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
timeout-minutes: 10 # 2025-11-06: Successful runs seem to take a minute or two, primarily since we wait for previous runs to complete.
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup tools
uses: ./.github/actions/tool-setup
- name: Building Action
env:
COMPOSER_ROOT_VERSION: dev-trunk
run: |
pnpm install
composer install
composer build-development
working-directory: ./projects/github-actions/repo-gardening
- name: Check out the PR
if: github.event_name == 'pull_request_target' && github.event.pull_request.state != 'closed'
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
# DO NOT run any code in this checkout. Not even an `npm install`.
path: ./pr-checkout
- name: Wait for prior instances of the workflow to finish
uses: ./.github/actions/turnstile
with:
# Split issues and issue_comment triggers from the rest. Otherwise a lot of issue work can result in pushes to trunk timing out.
events: ${{ case( github.event_name == 'issues' || github.event_name == 'issue_comment', 'issues issue_comment', '' ) }}
ignore-events: ${{ case( github.event_name == 'issues' || github.event_name == 'issue_comment', '', 'issues issue_comment' ) }}
- name: "Run the action (assign, manage milestones, for issues and PRs)"
uses: ./projects/github-actions/repo-gardening
env:
PR_WORKSPACE: ${{ github.workspace }}${{ case( github.event_name == 'pull_request_target', '/pr-checkout', '' ) }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
slack_token: ${{ secrets.SLACK_TOKEN }}
slack_team_channel: ${{ vars.SLACK_TEAM_CHANNEL }}
slack_design_channel: ${{ vars.SLACK_DESIGN_CHANNEL }}
slack_editorial_channel: ${{ vars.SLACK_EDITORIAL_CHANNEL }}
slack_he_triage_channel: ${{ vars.SLACK_HE_TRIAGE_CHANNEL }}
slack_quality_channel: ${{ vars.SLACK_QUALITY_CHANNEL }}
slack_product_ambassadors_channel: ${{ vars.SLACK_PRODUCT_AMBASSADORS_CHANNEL }}
triage_projects_token: ${{ secrets.PROJECT_AUTOMATION_TOKEN }}
project_board_url: ${{ vars.PROJECT_BOARD_URL }}
openai_api_key: ${{ secrets.OPENAI_API_KEY }}