Skip to content

Commit 0e340ea

Browse files
committed
Move to projectbot for automatic labelling of issues and PRs
1 parent 3e6d2ca commit 0e340ea

File tree

2 files changed

+116
-20
lines changed

2 files changed

+116
-20
lines changed

.github/project-bot.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Project Bot Configuration for APM AWS Lambda Extension
2+
# This configuration automates project management for issues and pull requests
3+
4+
# Define project configuration
5+
project:
6+
# Target project URL
7+
url: "https://github.com/orgs/elastic/projects/454"
8+
9+
# Rules for automatically managing issues and pull requests
10+
rules:
11+
# Rule for new issues
12+
- name: "New Issues"
13+
condition:
14+
- type: "issue"
15+
action: "opened"
16+
actions:
17+
- type: "add_to_project"
18+
column: "To Do"
19+
20+
# Rule for new internal pull requests
21+
- name: "New Internal PRs"
22+
condition:
23+
- type: "pull_request"
24+
action: "opened"
25+
author_association: ["MEMBER", "COLLABORATOR", "OWNER"]
26+
actions:
27+
- type: "add_to_project"
28+
column: "In Progress"
29+
30+
# Rule for new community pull requests
31+
- name: "New Community PRs"
32+
condition:
33+
- type: "pull_request"
34+
action: "opened"
35+
author_association: ["FIRST_TIME_CONTRIBUTOR", "CONTRIBUTOR", "NONE"]
36+
actions:
37+
- type: "add_to_project"
38+
column: "Community Review"
39+
40+
# Rule for when PRs are ready for review
41+
- name: "Ready for Review"
42+
condition:
43+
- type: "pull_request"
44+
action: "ready_for_review"
45+
actions:
46+
- type: "move_to_column"
47+
column: "Review"
48+
49+
# Rule for when PRs are converted to draft
50+
- name: "Draft PRs"
51+
condition:
52+
- type: "pull_request"
53+
action: "converted_to_draft"
54+
actions:
55+
- type: "move_to_column"
56+
column: "In Progress"
57+
58+
# Rule for closed issues and PRs
59+
- name: "Completed Items"
60+
condition:
61+
- type: "issue"
62+
action: "closed"
63+
- type: "pull_request"
64+
action: "closed"
65+
merged: true
66+
actions:
67+
- type: "move_to_column"
68+
column: "Done"
69+
70+
# Rule for items with specific labels
71+
- name: "Bug Issues"
72+
condition:
73+
- type: "issue"
74+
labels: ["bug"]
75+
actions:
76+
- type: "add_to_project"
77+
column: "Bug Triage"
78+
79+
- name: "Enhancement Requests"
80+
condition:
81+
- type: "issue"
82+
labels: ["enhancement", "feature-request"]
83+
actions:
84+
- type: "add_to_project"
85+
column: "Backlog"
86+
87+
# Columns that should exist in the project
88+
columns:
89+
- "To Do"
90+
- "In Progress"
91+
- "Review"
92+
- "Community Review"
93+
- "Bug Triage"
94+
- "Backlog"
95+
- "Done"

.github/workflows/labeler.yml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
name: "Issue+PR Labeler"
1+
name: "Project Bot"
22
on:
33
issues:
4-
types: [opened]
4+
types: [opened, edited, closed, reopened, labeled, unlabeled]
55
pull_request_target:
6-
types: [opened]
6+
types: [opened, edited, closed, reopened, labeled, unlabeled, ready_for_review, converted_to_draft]
7+
project_card:
8+
types: [created, moved, deleted]
79

810
permissions:
911
contents: read
1012
issues: write
1113
pull-requests: write
14+
repository-projects: write
1215

1316
jobs:
14-
triage:
17+
project_bot:
1518
runs-on: ubuntu-latest
1619
steps:
1720
- name: Get token
@@ -24,14 +27,24 @@ jobs:
2427
{
2528
"members": "read",
2629
"organization_projects": "write",
27-
"issues": "read"
30+
"issues": "write",
31+
"pull_requests": "write",
32+
"repository_projects": "write"
2833
}
34+
35+
- name: Run Project Bot
36+
uses: philschatz/project-bot@v1
37+
with:
38+
github-token: ${{ steps.get_token.outputs.token }}
39+
config-path: .github/project-bot.yml
40+
2941
- name: Add aws-λ-extension label
3042
uses: github/issue-labeler@c1b0f9f52a63158c4adc09425e858e87b32e9685 # v3.4
3143
with:
32-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
44+
repo-token: "${{ steps.get_token.outputs.token }}"
3345
configuration-path: .github/labeler-config.yml
3446
enable-versioned-regex: 0
47+
3548
- name: Check team membership for user
3649
uses: elastic/get-user-teams-membership@5fa8d08135326e44d74d0ec4ef8705d8e36df12d # 1.1.0
3750
id: checkUserMember
@@ -42,23 +55,11 @@ jobs:
4255
apmmachine
4356
dependabot
4457
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
45-
- name: Show team membership
46-
run: |
47-
echo "::debug::isTeamMember: ${{ steps.checkUserMember.outputs.isTeamMember }}"
48-
echo "::debug::isExcluded: ${{ steps.checkUserMember.outputs.isExcluded }}"
58+
4959
- name: Add community and triage labels
5060
if: steps.checkUserMember.outputs.isTeamMember != 'true' && steps.checkUserMember.outputs.isExcluded != 'true'
5161
uses: github/issue-labeler@c1b0f9f52a63158c4adc09425e858e87b32e9685 # v3.4
5262
with:
53-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
63+
repo-token: "${{ steps.get_token.outputs.token }}"
5464
configuration-path: .github/community-label.yml
5565
enable-versioned-regex: 0
56-
- name: Assign new internal pull requests to project
57-
uses: elastic/assign-one-project-github-action@2573c8fb01aadfde8f5b653eea21dd24569ca831 # 1.2.2
58-
if: (steps.checkUserMember.outputs.isTeamMember == 'true' || steps.checkUserMember.outputs.isExcluded == 'true') && github.event.pull_request
59-
with:
60-
project: 'https://github.com/orgs/elastic/projects/454'
61-
project_id: '5882982'
62-
column_name: 'In Progress'
63-
env:
64-
MY_GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}

0 commit comments

Comments
 (0)