diff --git a/.github/workflows/post-merge-validation.yml b/.github/workflows/post-merge-validation.yml new file mode 100644 index 00000000..04ae14d7 --- /dev/null +++ b/.github/workflows/post-merge-validation.yml @@ -0,0 +1,102 @@ +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 + required: true + type: string + pr-title: + description: The PR title + required: true + type: string + +jobs: + post-merge-validation: + 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}, + + 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 + + `; + + // 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}`); + } + + // 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}`); + }