Skip to content

Commit 8af92a4

Browse files
committed
Sync issue automation with element-web
Add automation for * labelling Labs issues * adding design and product issues to boards * adding design and product PRs to boards * adding UISI issues to Crypto team board Fixes issue #4949
1 parent 194a584 commit 8af92a4

File tree

5 files changed

+244
-28
lines changed

5 files changed

+244
-28
lines changed

.github/workflows/triage-move-labelled.yml renamed to .github/workflows/triage-labelled.yml

+75-26
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ on:
55
types: [labeled]
66

77
jobs:
8+
apply_Z-Labs_label:
9+
name: Add Z-Labs label for features behind labs flags
10+
runs-on: ubuntu-latest
11+
if: >
12+
contains(github.event.issue.labels.*.name, 'A-Maths') ||
13+
contains(github.event.issue.labels.*.name, 'A-Message-Pinning') ||
14+
contains(github.event.issue.labels.*.name, 'A-Threads') ||
15+
contains(github.event.issue.labels.*.name, 'A-Polls') ||
16+
contains(github.event.issue.labels.*.name, 'A-Location-Sharing') ||
17+
contains(github.event.issue.labels.*.name, 'A-Message-Bubbles') ||
18+
contains(github.event.issue.labels.*.name, 'Z-IA') ||
19+
contains(github.event.issue.labels.*.name, 'A-Themes-Custom') ||
20+
contains(github.event.issue.labels.*.name, 'A-E2EE-Dehydration') ||
21+
contains(github.event.issue.labels.*.name, 'A-Tags')
22+
steps:
23+
- uses: actions/github-script@v5
24+
with:
25+
script: |
26+
github.rest.issues.addLabels({
27+
issue_number: context.issue.number,
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
labels: ['Z-Labs']
31+
})
32+
833
move_needs_info_issues:
934
name: X-Needs-Info issues to Need info column on triage board
1035
runs-on: ubuntu-latest
@@ -51,32 +76,56 @@ jobs:
5176
PROJECT_ID: "PN_kwDOAM0swc0sUA"
5277
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
5378

54-
# delight_issues_to_board:
55-
# name: Spaces issues to new Delight project board
56-
# runs-on: ubuntu-latest
57-
# # Skip in forks
58-
# if: >
59-
# github.repository == 'vector-im/element-android' &&
60-
# contains(github.event.issue.labels.*.name, 'A-Spaces') ||
61-
# contains(github.event.issue.labels.*.name, 'A-Space-Settings') ||
62-
# contains(github.event.issue.labels.*.name, 'A-Subspaces')
63-
# steps:
64-
# - uses: octokit/[email protected]
65-
# with:
66-
# headers: '{"GraphQL-Features": "projects_next_graphql"}'
67-
# query: |
68-
# mutation add_to_project($projectid:ID!,$contentid:ID!) {
69-
# addProjectNextItem(input:{projectId:$projectid contentId:$contentid}) {
70-
# projectNextItem {
71-
# id
72-
# }
73-
# }
74-
# }
75-
# projectid: ${{ env.PROJECT_ID }}
76-
# contentid: ${{ github.event.issue.node_id }}
77-
# env:
78-
# PROJECT_ID: "PN_kwDOAM0swc1HvQ"
79-
# GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
79+
add_product_issues:
80+
name: X-Needs-Product to Design project board
81+
runs-on: ubuntu-latest
82+
if: >
83+
contains(github.event.issue.labels.*.name, 'X-Needs-Product')
84+
steps:
85+
- uses: octokit/[email protected]
86+
id: add_to_project
87+
with:
88+
headers: '{"GraphQL-Features": "projects_next_graphql"}'
89+
query: |
90+
mutation add_to_project($projectid:ID!,$contentid:ID!) {
91+
addProjectNextItem(input:{projectId:$projectid contentId:$contentid}) {
92+
projectNextItem {
93+
id
94+
}
95+
}
96+
}
97+
projectid: ${{ env.PROJECT_ID }}
98+
contentid: ${{ github.event.issue.node_id }}
99+
env:
100+
PROJECT_ID: "PN_kwDOAM0swc4AAg6N"
101+
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
102+
103+
# delight_issues_to_board:
104+
# name: Spaces issues to new Delight project board
105+
# runs-on: ubuntu-latest
106+
# # Skip in forks
107+
# if: >
108+
# github.repository == 'vector-im/element-android' &&
109+
# contains(github.event.issue.labels.*.name, 'A-Spaces') ||
110+
# contains(github.event.issue.labels.*.name, 'A-Space-Settings') ||
111+
# contains(github.event.issue.labels.*.name, 'A-Subspaces')
112+
# steps:
113+
# - uses: octokit/[email protected]
114+
# with:
115+
# headers: '{"GraphQL-Features": "projects_next_graphql"}'
116+
# query: |
117+
# mutation add_to_project($projectid:ID!,$contentid:ID!) {
118+
# addProjectNextItem(input:{projectId:$projectid contentId:$contentid}) {
119+
# projectNextItem {
120+
# id
121+
# }
122+
# }
123+
# }
124+
# projectid: ${{ env.PROJECT_ID }}
125+
# contentid: ${{ github.event.issue.node_id }}
126+
# env:
127+
# PROJECT_ID: "PN_kwDOAM0swc1HvQ"
128+
# GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
80129

81130
move_voice-message_issues:
82131
name: A-Voice Messages to voice message board
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Move pull requests asking for review to the relevant project
2+
on:
3+
pull_request_target:
4+
types: [review_requested]
5+
6+
jobs:
7+
add_design_pr_to_project:
8+
name: Move PRs asking for design review to the design board
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: octokit/[email protected]
12+
id: find_team_members
13+
with:
14+
headers: '{"GraphQL-Features": "projects_next_graphql"}'
15+
query: |
16+
query find_team_members($team: String!) {
17+
organization(login: "vector-im") {
18+
team(slug: $team) {
19+
members {
20+
nodes {
21+
login
22+
}
23+
}
24+
}
25+
}
26+
}
27+
team: ${{ env.TEAM }}
28+
env:
29+
TEAM: "design"
30+
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
31+
- id: any_matching_reviewers
32+
run: |
33+
# Fetch requested reviewers, and people who are on the team
34+
echo '${{ tojson(fromjson(steps.find_team_members.outputs.data).organization.team.members.nodes[*].login) }}' | tee /tmp/team_members.json
35+
echo '${{ tojson(github.event.pull_request.requested_reviewers[*].login) }}' | tee /tmp/reviewers.json
36+
jq --raw-output .[] < /tmp/team_members.json | sort | tee /tmp/team_members.txt
37+
jq --raw-output .[] < /tmp/reviewers.json | sort | tee /tmp/reviewers.txt
38+
39+
# Fetch requested team reviewers, and the name of the team
40+
echo '${{ tojson(github.event.pull_request.requested_teams[*].slug) }}' | tee /tmp/team_reviewers.json
41+
jq --raw-output .[] < /tmp/team_reviewers.json | sort | tee /tmp/team_reviewers.txt
42+
echo '${{ env.TEAM }}' | tee /tmp/team.txt
43+
44+
# If either a reviewer matches a team member, or a team matches our team, say "true"
45+
if [ $(join /tmp/team_members.txt /tmp/reviewers.txt | wc -l) != 0 ]; then
46+
echo "::set-output name=match::true"
47+
elif [ $(join /tmp/team.txt /tmp/team_reviewers.txt | wc -l) != 0 ]; then
48+
echo "::set-output name=match::true"
49+
else
50+
echo "::set-output name=match::false"
51+
fi
52+
env:
53+
TEAM: "design"
54+
- uses: octokit/[email protected]
55+
id: add_to_project
56+
if: steps.any_matching_reviewers.outputs.match == 'true'
57+
with:
58+
headers: '{"GraphQL-Features": "projects_next_graphql"}'
59+
query: |
60+
mutation add_to_project($projectid:ID!, $contentid:ID!) {
61+
addProjectNextItem(input:{projectId:$projectid contentId:$contentid}) {
62+
projectNextItem {
63+
id
64+
}
65+
}
66+
}
67+
projectid: ${{ env.PROJECT_ID }}
68+
contentid: ${{ github.event.pull_request.node_id }}
69+
env:
70+
PROJECT_ID: "PN_kwDOAM0swc0sUA"
71+
TEAM: "design"
72+
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
73+
74+
add_product_pr_to_project:
75+
name: Move PRs asking for product review to the product board
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: octokit/[email protected]
79+
id: find_team_members
80+
with:
81+
headers: '{"GraphQL-Features": "projects_next_graphql"}'
82+
query: |
83+
query find_team_members($team: String!) {
84+
organization(login: "vector-im") {
85+
team(slug: $team) {
86+
members {
87+
nodes {
88+
login
89+
}
90+
}
91+
}
92+
}
93+
}
94+
team: ${{ env.TEAM }}
95+
env:
96+
TEAM: "product"
97+
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
98+
- id: any_matching_reviewers
99+
run: |
100+
# Fetch requested reviewers, and people who are on the team
101+
echo '${{ tojson(fromjson(steps.find_team_members.outputs.data).organization.team.members.nodes[*].login) }}' | tee /tmp/team_members.json
102+
echo '${{ tojson(github.event.pull_request.requested_reviewers[*].login) }}' | tee /tmp/reviewers.json
103+
jq --raw-output .[] < /tmp/team_members.json | sort | tee /tmp/team_members.txt
104+
jq --raw-output .[] < /tmp/reviewers.json | sort | tee /tmp/reviewers.txt
105+
106+
# Fetch requested team reviewers, and the name of the team
107+
echo '${{ tojson(github.event.pull_request.requested_teams[*].slug) }}' | tee /tmp/team_reviewers.json
108+
jq --raw-output .[] < /tmp/team_reviewers.json | sort | tee /tmp/team_reviewers.txt
109+
echo '${{ env.TEAM }}' | tee /tmp/team.txt
110+
111+
# If either a reviewer matches a team member, or a team matches our team, say "true"
112+
if [ $(join /tmp/team_members.txt /tmp/reviewers.txt | wc -l) != 0 ]; then
113+
echo "::set-output name=match::true"
114+
elif [ $(join /tmp/team.txt /tmp/team_reviewers.txt | wc -l) != 0 ]; then
115+
echo "::set-output name=match::true"
116+
else
117+
echo "::set-output name=match::false"
118+
fi
119+
env:
120+
TEAM: "product"
121+
- uses: octokit/[email protected]
122+
id: add_to_project
123+
if: steps.any_matching_reviewers.outputs.match == 'true'
124+
with:
125+
headers: '{"GraphQL-Features": "projects_next_graphql"}'
126+
query: |
127+
mutation add_to_project($projectid:ID!, $contentid:ID!) {
128+
addProjectNextItem(input:{projectId:$projectid contentId:$contentid}) {
129+
projectNextItem {
130+
id
131+
}
132+
}
133+
}
134+
projectid: ${{ env.PROJECT_ID }}
135+
contentid: ${{ github.event.pull_request.node_id }}
136+
env:
137+
PROJECT_ID: "PN_kwDOAM0swc4AAg6N"
138+
TEAM: "product"
139+
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}

.github/workflows/triage-priority-bugs.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ jobs:
3838
# Skip in forks
3939
if: >
4040
github.repository == 'vector-im/element-android' &&
41-
(contains(github.event.issue.labels.*.name, 'A-E2EE') ||
41+
(contains(github.event.issue.labels.*.name, 'Z-UISI') ||
42+
(contains(github.event.issue.labels.*.name, 'A-E2EE') ||
4243
contains(github.event.issue.labels.*.name, 'A-E2EE-Cross-Signing') ||
4344
contains(github.event.issue.labels.*.name, 'A-E2EE-Dehydration') ||
4445
contains(github.event.issue.labels.*.name, 'A-E2EE-Key-Backup') ||
@@ -50,7 +51,7 @@ jobs:
5051
contains(github.event.issue.labels.*.name, 'S-Major') &&
5152
contains(github.event.issue.labels.*.name, 'O-Frequent') ||
5253
contains(github.event.issue.labels.*.name, 'A11y') &&
53-
contains(github.event.issue.labels.*.name, 'O-Frequent'))
54+
contains(github.event.issue.labels.*.name, 'O-Frequent')))
5455
steps:
5556
- uses: alex-page/github-project-automation-plus@bb266ff4dde9242060e2d5418e120a133586d488
5657
with:

.github/workflows/triage-move-unlabelled.yml renamed to .github/workflows/triage-unlabelled.yml

+26
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,29 @@ jobs:
3434
project: Issue triage
3535
column: Triaged
3636
repo-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
37+
38+
remove_Z-Labs_label:
39+
name: Remove Z-Labs label when features behind labs flags are removed
40+
runs-on: ubuntu-latest
41+
if: >
42+
!(contains(github.event.issue.labels.*.name, 'A-Maths') ||
43+
contains(github.event.issue.labels.*.name, 'A-Message-Pinning') ||
44+
contains(github.event.issue.labels.*.name, 'A-Threads') ||
45+
contains(github.event.issue.labels.*.name, 'A-Polls') ||
46+
contains(github.event.issue.labels.*.name, 'A-Location-Sharing') ||
47+
contains(github.event.issue.labels.*.name, 'A-Message-Bubbles') ||
48+
contains(github.event.issue.labels.*.name, 'Z-IA') ||
49+
contains(github.event.issue.labels.*.name, 'A-Themes-Custom') ||
50+
contains(github.event.issue.labels.*.name, 'A-E2EE-Dehydration') ||
51+
contains(github.event.issue.labels.*.name, 'A-Tags')) &&
52+
contains(github.event.issue.labels.*.name, 'Z-Labs')
53+
steps:
54+
- uses: actions/github-script@v5
55+
with:
56+
script: |
57+
github.rest.issues.removeLabel({
58+
issue_number: context.issue.number,
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
name: ['Z-Labs']
62+
})

changelog.d/4949.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sync issue automation with element-web

0 commit comments

Comments
 (0)