Skip to content

Commit 2d82b7b

Browse files
committed
Update workflows to actions
1 parent 8378650 commit 2d82b7b

5 files changed

Lines changed: 348 additions & 366 deletions

File tree

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,51 @@
1-
name: Get release timelines
1+
name: Get Release Timelines
2+
description: 'Get release timelines from Runway and upload as artifact.'
23

3-
on:
4-
workflow_call:
5-
inputs:
6-
version:
7-
required: true
8-
type: string
9-
description: The version of the release
10-
secrets:
11-
RUNWAY_APP_ID:
12-
required: true
13-
RUNWAY_API_KEY:
14-
required: true
4+
inputs:
5+
version:
6+
required: true
7+
description: The version of the release.
8+
github-token:
9+
required: true
10+
description: The GitHub token used for authentication.
11+
runway-app-id:
12+
required: true
13+
description: The Runway application ID.
14+
runway-api-key:
15+
required: true
16+
description: The Runway API key.
17+
github-tools-repository:
18+
description: 'The GitHub repository containing the GitHub tools. Defaults to the GitHub tools action repositor, and usually does not need to be changed.'
19+
required: false
20+
default: ${{ github.action_repository }}
21+
github-tools-ref:
22+
description: 'The SHA of the action to use. Defaults to the current action ref, and usually does not need to be changed.'
23+
required: false
24+
default: ${{ github.action_ref }}
1525

16-
jobs:
17-
get-release-timelines:
18-
runs-on: ubuntu-latest
19-
steps:
20-
- name: Checkout the 'github-tools' repository
21-
uses: actions/checkout@v4
22-
with:
23-
repository: metamask/github-tools
26+
runs:
27+
using: composite
28+
steps:
29+
- name: Checkout GitHub tools repository
30+
uses: actions/checkout@v5
31+
with:
32+
repository: ${{ inputs.github-tools-repository }}
33+
ref: ${{ inputs.github-tools-ref }}
34+
path: ./github-tools
2435

25-
- name: Get release timelines
26-
env:
27-
OWNER: ${{ github.repository_owner }}
28-
REPOSITORY: ${{ github.event.repository.name }}
29-
VERSION: ${{ inputs.version }}
30-
RUNWAY_APP_ID: ${{ secrets.RUNWAY_APP_ID }}
31-
RUNWAY_API_KEY: ${{ secrets.RUNWAY_API_KEY }}
32-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
run: .github/scripts/get-release-timelines.sh
36+
- name: Get release timelines
37+
env:
38+
OWNER: ${{ github.repository_owner }}
39+
REPOSITORY: ${{ github.event.repository.name }}
40+
VERSION: ${{ inputs.version }}
41+
RUNWAY_APP_ID: ${{ inputs.runway-app-id }}
42+
RUNWAY_API_KEY: ${{ inputs.runway-api-key }}
43+
GH_TOKEN: ${{ inputs.github-token }}
44+
shell: bash
45+
run: ./github-tools/.github/scripts/get-release-timelines.sh
3446

35-
- name: Upload artifact release-timelines-${{ inputs.version }}.csv
36-
uses: actions/upload-artifact@v4
37-
with:
38-
name: release-timelines-${{ inputs.version }}.csv
39-
path: release-timelines-${{ inputs.version }}.csv
47+
- name: Upload artifact release-timelines-${{ inputs.version }}.csv
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: release-timelines-${{ inputs.version }}.csv
51+
path: release-timelines-${{ inputs.version }}.csv
Lines changed: 132 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,137 @@
11
name: Post RCA Form
2-
3-
permissions:
4-
issues: write
5-
contents: read
6-
7-
on:
8-
workflow_call:
9-
inputs:
10-
google-form-base-url:
11-
description: Base URL of the Google Form.
12-
default: 'https://docs.google.com/forms/d/e/1FAIpQLSeLOVVUy7mO1j-5Isb04OAWk3dM0b1NY1R8kf0tiEBs9elcEg/viewform?usp=pp_url'
13-
type: string
14-
repo-owner:
15-
description: The repo owner
16-
required: true
17-
type: string
18-
repo-name:
19-
description: The repo name
20-
required: true
21-
type: string
22-
issue-number:
23-
description: The number of the closed issue
24-
required: true
25-
type: string
26-
issue-labels:
27-
description: JSON-stringified array of labels that should trigger the RCA prompt
28-
required: true
29-
type: string
30-
entry-issue:
31-
description: The entry ID for the issue field in the Google Form
32-
default: 'entry.1417567074'
33-
type: string
34-
entry-regression:
35-
description: The entry ID for the regression field in the Google Form
36-
default: 'entry.1470697156'
37-
type: string
38-
entry-team:
39-
description: The entry ID for the team field in the Google Form
40-
default: 'entry.1198657478'
41-
type: string
42-
entry-repo-name:
43-
description: The entry ID for the repository name field
44-
default: 'entry.1085838323'
45-
type: string
46-
entry-issue-url:
47-
description: The entry ID for the GitHub issue URL field
48-
default: 'entry.516762472'
49-
type: string
50-
51-
jobs:
52-
post-rca-form:
53-
name: Post Google Form link and log results on issue close
54-
runs-on: ubuntu-latest
55-
steps:
56-
- name: Post RCA Form Link
57-
uses: actions/github-script@v7
58-
env:
59-
GOOGLE_FORM_BASE_URL: ${{ inputs.google-form-base-url }}
60-
ISSUE_LABELS: ${{ inputs.issue-labels }}
61-
OWNER_NAME: ${{ inputs.repo-owner }}
62-
REPO_NAME: ${{ inputs.repo-name }}
63-
ISSUE_NUMBER: ${{ inputs.issue-number }}
64-
ENTRY_ISSUE: ${{ inputs.entry-issue }}
65-
ENTRY_REGRESSION: ${{ inputs.entry-regression }}
66-
ENTRY_TEAM: ${{ inputs.entry-team }}
67-
ENTRY_REPO_NAME: ${{ inputs.entry-repo-name }}
68-
ENTRY_ISSUE_URL: ${{ inputs.entry-issue-url }}
69-
with:
70-
github-token: ${{ secrets.GITHUB_TOKEN }}
71-
script: |
72-
const {
73-
GOOGLE_FORM_BASE_URL: baseUrl,
74-
ENTRY_ISSUE,
75-
ENTRY_REGRESSION,
76-
ENTRY_TEAM,
77-
ENTRY_REPO_NAME,
78-
ENTRY_ISSUE_URL,
79-
OWNER_NAME: owner,
80-
REPO_NAME: repo,
81-
ISSUE_NUMBER: issueNumStr,
82-
} = process.env;
83-
84-
const issue_number = parseInt(issueNumStr, 10);
85-
const allowedLabels = JSON.parse(process.env.ISSUE_LABELS);
86-
87-
// Fetch issue details to get the assignees
88-
const { data: issue } = await github.rest.issues.get({
2+
description: 'Posts a Google Form link for RCA on issues with specific labels.'
3+
4+
inputs:
5+
google-form-base-url:
6+
description: Base URL of the Google Form.
7+
default: 'https://docs.google.com/forms/d/e/1FAIpQLSeLOVVUy7mO1j-5Isb04OAWk3dM0b1NY1R8kf0tiEBs9elcEg/viewform?usp=pp_url'
8+
repo-owner:
9+
description: The repo owner
10+
required: true
11+
repo-name:
12+
description: The repo name
13+
required: true
14+
issue-number:
15+
description: The number of the closed issue
16+
required: true
17+
issue-labels:
18+
description: JSON-stringified array of labels that should trigger the RCA prompt
19+
required: true
20+
entry-issue:
21+
description: The entry ID for the issue field in the Google Form
22+
default: 'entry.1417567074'
23+
entry-regression:
24+
description: The entry ID for the regression field in the Google Form
25+
default: 'entry.1470697156'
26+
entry-team:
27+
description: The entry ID for the team field in the Google Form
28+
default: 'entry.1198657478'
29+
entry-repo-name:
30+
description: The entry ID for the repository name field
31+
default: 'entry.1085838323'
32+
entry-issue-url:
33+
description: The entry ID for the GitHub issue URL field
34+
default: 'entry.516762472'
35+
github-token:
36+
description: GitHub token for authentication
37+
required: true
38+
39+
runs:
40+
using: composite
41+
steps:
42+
- name: Post RCA Form Link
43+
uses: actions/github-script@v8
44+
env:
45+
GOOGLE_FORM_BASE_URL: ${{ inputs.google-form-base-url }}
46+
ISSUE_LABELS: ${{ inputs.issue-labels }}
47+
OWNER_NAME: ${{ inputs.repo-owner }}
48+
REPO_NAME: ${{ inputs.repo-name }}
49+
ISSUE_NUMBER: ${{ inputs.issue-number }}
50+
ENTRY_ISSUE: ${{ inputs.entry-issue }}
51+
ENTRY_REGRESSION: ${{ inputs.entry-regression }}
52+
ENTRY_TEAM: ${{ inputs.entry-team }}
53+
ENTRY_REPO_NAME: ${{ inputs.entry-repo-name }}
54+
ENTRY_ISSUE_URL: ${{ inputs.entry-issue-url }}
55+
with:
56+
github-token: ${{ inputs.github-token }}
57+
script: |
58+
const {
59+
GOOGLE_FORM_BASE_URL: baseUrl,
60+
ENTRY_ISSUE,
61+
ENTRY_REGRESSION,
62+
ENTRY_TEAM,
63+
ENTRY_REPO_NAME,
64+
ENTRY_ISSUE_URL,
65+
OWNER_NAME: owner,
66+
REPO_NAME: repo,
67+
ISSUE_NUMBER: issueNumStr,
68+
} = process.env;
69+
70+
const issue_number = parseInt(issueNumStr, 10);
71+
const allowedLabels = JSON.parse(process.env.ISSUE_LABELS);
72+
73+
// Fetch issue details to get the assignees
74+
const { data: issue } = await github.rest.issues.get({
75+
owner,
76+
repo,
77+
issue_number: issue_number,
78+
});
79+
80+
const hasAllowedLabel = issue.labels.some(label =>
81+
allowedLabels.includes(label.name)
82+
);
83+
84+
if (!hasAllowedLabel) {
85+
console.log(`❌ Issue #${issue_number} skipped — no matching label.`);
86+
return;
87+
}
88+
89+
// if it's a sev1-high or sev0-high, lets grab team and regression labels, if there's any
90+
// if there's none, an empty value will be sent, which is what we want
91+
const teamLabels = issue.labels
92+
.map(l => l.name)
93+
.filter(n => n.startsWith('team-'));
94+
95+
const regressionLabels = issue.labels
96+
.map(l => l.name)
97+
.filter(n => n.startsWith('regression-'));
98+
99+
const formUrl = new URL(baseUrl);
100+
formUrl.searchParams.set(ENTRY_ISSUE, issue_number);
101+
formUrl.searchParams.set(
102+
ENTRY_REGRESSION,
103+
regressionLabels.length ? regressionLabels.join(',') : ''
104+
);
105+
formUrl.searchParams.set(
106+
ENTRY_TEAM,
107+
teamLabels.length ? teamLabels.join(',') : ''
108+
);
109+
110+
formUrl.searchParams.set(ENTRY_REPO_NAME, repo);
111+
formUrl.searchParams.set(ENTRY_ISSUE_URL, `https://github.com/${owner}/${repo}/issues/${issue_number}`);
112+
113+
const assignees = issue.assignees.map(u=>`@${u.login}`).join(', ');
114+
const body = `Hi ${assignees},
115+
116+
This issue has been closed. Please complete this RCA form:
117+
${formUrl.toString()}
118+
119+
<!-- AUTO-FORM -->`;
120+
121+
await github.rest.issues.createComment({
122+
owner, repo, issue_number, body
123+
});
124+
console.log(`✅ Comment posted on issue #${issue_number}`);
125+
126+
// Add the RCA-needed label
127+
try {
128+
await github.rest.issues.addLabels({
89129
owner,
90130
repo,
91131
issue_number: issue_number,
132+
labels: ['RCA-needed']
92133
});
93-
94-
const hasAllowedLabel = issue.labels.some(label =>
95-
allowedLabels.includes(label.name)
96-
);
97-
98-
if (!hasAllowedLabel) {
99-
console.log(`❌ Issue #${issue_number} skipped — no matching label.`);
100-
return;
101-
}
102-
103-
// if it's a sev1-high or sev0-high, lets grab team and regression labels, if there's any
104-
// if there's none, an empty value will be sent, which is what we want
105-
const teamLabels = issue.labels
106-
.map(l => l.name)
107-
.filter(n => n.startsWith('team-'));
108-
109-
const regressionLabels = issue.labels
110-
.map(l => l.name)
111-
.filter(n => n.startsWith('regression-'));
112-
113-
const formUrl = new URL(baseUrl);
114-
formUrl.searchParams.set(ENTRY_ISSUE, issue_number);
115-
formUrl.searchParams.set(
116-
ENTRY_REGRESSION,
117-
regressionLabels.length ? regressionLabels.join(',') : ''
118-
);
119-
formUrl.searchParams.set(
120-
ENTRY_TEAM,
121-
teamLabels.length ? teamLabels.join(',') : ''
122-
);
123-
124-
formUrl.searchParams.set(ENTRY_REPO_NAME, repo);
125-
formUrl.searchParams.set(ENTRY_ISSUE_URL, `https://github.com/${owner}/${repo}/issues/${issue_number}`);
126-
127-
const assignees = issue.assignees.map(u=>`@${u.login}`).join(', ');
128-
const body = `Hi ${assignees},
129-
130-
This issue has been closed. Please complete this RCA form:
131-
${formUrl.toString()}
132-
133-
<!-- AUTO-FORM -->`;
134-
135-
await github.rest.issues.createComment({
136-
owner, repo, issue_number, body
137-
});
138-
console.log(`✅ Comment posted on issue #${issue_number}`);
139-
140-
// Add the RCA-needed label
141-
try {
142-
await github.rest.issues.addLabels({
143-
owner,
144-
repo,
145-
issue_number: issue_number,
146-
labels: ['RCA-needed']
147-
});
148-
console.log(`✅ Added 'RCA-needed' label on issue #${issue_number}`);
149-
} catch (error) {
150-
console.log(`⚠️ Could not add label: ${error.message}`);
151-
}
134+
console.log(`✅ Added 'RCA-needed' label on issue #${issue_number}`);
135+
} catch (error) {
136+
console.log(`⚠️ Could not add label: ${error.message}`);
137+
}

0 commit comments

Comments
 (0)