Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
edaed87
ci: add a post merge validation tracker
jvbriones Aug 11, 2025
9dcffad
ci: add a post merge validation tracker
jvbriones Aug 11, 2025
6e39195
ci: add a post merge validation tracker
jvbriones Aug 12, 2025
e41c67f
ci: add a post merge validation tracker
jvbriones Aug 12, 2025
d005d55
ci: add a post merge validation tracker
jvbriones Aug 12, 2025
038d91f
ci: add a post merge validation tracker
jvbriones Aug 12, 2025
011b6b8
ci: add a post merge validation tracker
jvbriones Aug 12, 2025
c3d91fe
ci: add a post merge validation tracker
jvbriones Aug 13, 2025
92da9f0
ci: add a post merge validation tracker
jvbriones Aug 14, 2025
b6d50da
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
84bb913
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
cf27931
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
4f585f4
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
9253949
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
c32d620
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
a17cc83
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
b20cefd
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
3306f86
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
abcef29
ci: adapt the post merge validation job to track progress in a google…
jvbriones Aug 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ci: adapt the post merge validation job to track progress in a google…
… sheet
  • Loading branch information
jvbriones committed Aug 14, 2025
commit b6d50dad9c642deac57d09d71bb79c7b501f0c2e
35 changes: 12 additions & 23 deletions .github/scripts/post-merge-validation-tracker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,21 @@ import { Octokit } from '@octokit/rest';
const githubToken = process.env.GITHUB_TOKEN;
const spreadsheetId = process.env.SHEET_ID;
const googleApplicationCredentialsBase64 = process.env.GOOGLE_APPLICATION_CREDENTIALS_BASE64;
const repo = process.env.REPO;
const LOOKBACK_DAYS = parseInt(process.env.LOOKBACK_DAYS) || 2;
const START_HOUR_UTC = parseInt(process.env.START_HOUR_UTC) || 7;

const REPOS = [
'MetaMask/metamask-mobile',
'MetaMask/metamask-extension'
];


const START_MINUTE_UTC = 0;
const RELEVANT_TITLE_REGEX = /^(feat|perf)(\(|:|!)|(\b)bump(\b)/i;
const TEAM_LABEL_PREFIX = 'team-';
const SIZE_LABEL_PREFIX = 'size-';
const LOOKBACK_DAYS = 2;

// When the window starts each day (UTC)
const START_HOUR_UTC = 7;
const START_MINUTE_UTC = 0;

if (!githubToken) throw new Error('Missing GITHUB_TOKEN env var');
if (!spreadsheetId) throw new Error('Missing SHEET_ID env var');
if (!googleApplicationCredentialsBase64)
throw new Error('Missing GOOGLE_APPLICATION_CREDENTIALS_BASE64 env var');
if (!repo) throw new Error('Missing REPO env var');

const octokit = new Octokit({ auth: githubToken });
const sheets = google.sheets('v4');
Expand All @@ -37,12 +32,10 @@ async function getGoogleAuth() {
return auth.getClient();
}

function getRepos() {
return REPOS.map((p) => {
const [owner, repo] = p.split('/');
if (!owner || !repo) throw new Error(`Invalid repo "${p}"`);
return { owner, repo };
});
function parseRepo() {
const [owner, repoName] = repo.split('/');
if (!owner || !repoName) throw new Error(`Invalid repo format "${repo}". Expected format: "owner/repo"`);
return { owner, repo: repoName };
}

function repoType(repo) {
Expand Down Expand Up @@ -659,17 +652,13 @@ async function processRepo(authClient, owner, repo, since) {

async function main() {
const authClient = await getGoogleAuth();
const repos = getRepos();
const { owner, repo: repoName } = parseRepo();
const since = isoSinceAtUTC(LOOKBACK_DAYS, START_HOUR_UTC, START_MINUTE_UTC);
console.log(
`Starting post-merge validation tracker. Mode=Sheets; Since(UTC)=${since}; Repos=${repos
.map((r) => `${r.owner}/${r.repo}`)
.join(', ')}`,
`Starting post-merge validation tracker. Mode=Sheets; Since(UTC)=${since}; Repo=${owner}/${repoName}`,
);

for (const { owner, repo } of repos) {
await processRepo(authClient, owner, repo, since);
}
await processRepo(authClient, owner, repoName, since);
}

main().catch((e) => {
Expand Down
128 changes: 43 additions & 85 deletions .github/workflows/post-merge-validation.yml
Original file line number Diff line number Diff line change
@@ -1,102 +1,60 @@
name: Post Merge Validation

permissions:
pull-requests: write
contents: read

on:
workflow_call:
inputs:
repo-owner:
description: The repo owner
required: true
type: string
repo-name:
description: The repo name
required: true
type: string
pr-number:
description: The number of the merged PR
required: true
type: string
pr-author:
description: The PR author username
repo:
description: 'The repo owner/name to process (e.g. MetaMask/metamask-extension)''
required: true
type: string
pr-title:
description: The PR title
start_hour_utc:
description: 'The hour of the day (UTC) to start processing the PRs merged in main'
required: true
type: number
spreadsheet_id:
description: 'Google Spreadsheet ID to update'
required: false
type: string
default: '1uSERA-Mczy0pjlrr1vvYG0FZwU65B7TMiQURJXY4tSs'
lookback_days:
description: 'Number of days to look back for PRs'
required: false
type: number
default: 2
secrets:
github-token:
description: 'GitHub token with repo access'
required: true
google-application-creds-base64:
description: 'Base64 encoded Google service account credentials'
required: true

jobs:
post-merge-validation:
post-merge-validation-tracker:
runs-on: ubuntu-latest
steps:
- name: Post Feature Validation Checklist
uses: actions/github-script@v7
env:
OWNER_NAME: ${{ inputs.repo-owner }}
REPO_NAME: ${{ inputs.repo-name }}
PR_NUMBER: ${{ inputs.pr-number }}
PR_AUTHOR: ${{ inputs.pr-author }}
PR_TITLE: ${{ inputs.pr-title }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const {
OWNER_NAME: owner,
REPO_NAME: repo,
PR_NUMBER: prNumStr,
PR_AUTHOR: author,
PR_TITLE: title,
} = process.env;

const pull_number = parseInt(prNumStr, 10);

// Check if PR title starts with "feat" or "perf" (conventional commits)
const titleLower = title.toLowerCase();
if (!titleLower.startsWith('feat:') && !titleLower.startsWith('feat(') &&
!titleLower.startsWith('perf:') && !titleLower.startsWith('perf(')) {
console.log(`❌ PR #${pull_number} title doesn't start with feat or perf - skipping.`);
return;
}

const body = `Hi @${author},
- name: Checkout repository
uses: actions/checkout@v4

on the day following \`feat\` or \`perf\` PR merge, PM and author to test changes on main (feature + exploratory around the edges) using the latest [nightly build](https://consensys.slack.com/archives/C093JQSEPJL) with [casual user persona](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085221547/Mobile+User+Persona+Definition) and also a [power user persona](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085221547/Mobile+User+Persona+Definition) where performance might be a challenge. Please record the testing in a video, check the relevant post-merge checklist box below, and post the video in a comment at the bottom of this PR.

### Author validation checklist
- [ ] Validated the changes in main branch using the nightly build
- [ ] Video shared

### PM validation checklist
- [ ] Validated the changes in main branch using the nightly build
- [ ] Video shared
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: ./.nvmrc
cache-dependency-path: ./yarn.lock
cache: yarn

<!-- AUTO-VALIDATION-CHECKLIST PR:${pull_number} -->`;
- name: Enable Corepack
run: corepack enable

// Post the comment
try {
await github.rest.issues.createComment({
owner,
repo,
issue_number: pull_number,
body
});
console.log(`✅ Validation checklist posted on PR #${pull_number}`);
} catch (error) {
console.log(`⚠️ Could not post comment: ${error.message}`);
}
- name: Install dependencies
run: yarn --immutable

// Add the needs-validation label
try {
await github.rest.issues.addLabels({
owner,
repo,
issue_number: pull_number,
labels: ['needs-validation']
});
console.log(`✅ Added 'needs-validation' label to PR #${pull_number}`);
} catch (error) {
console.log(`⚠️ Could not add label: ${error.message}`);
}
- name: Run post-merge-validation script
env:
SHEET_ID: ${{ inputs.spreadsheet_id }}
START_HOUR_UTC: ${{ inputs.start_hour_utc }}
LOOKBACK_DAYS: ${{ inputs.lookback_days }}
REPO: ${{ inputs.repo }}
GITHUB_TOKEN: ${{ secrets.github-token }}
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.google-application-creds-base64 }}
run: node .github/scripts/post-merge-validation-tracker.mjs
33 changes: 0 additions & 33 deletions .github/workflows/test-post-merge-validation-tracker.yml

This file was deleted.

Loading