Repository navigation
feat: add draft Segment schema PR workflow - #37219
Conversation
Propose, create, and close a Consensys/segment-schema draft from analytics TypeScript changes after the author agrees. Co-authored-by: Cursor <cursoragent@cursor.com>
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Remove DRAFT_SCHEMA_PR_WORKFLOW_TEST before merging this pull request. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #37219 +/- ##
==========================================
+ Coverage 86.77% 86.80% +0.02%
==========================================
Files 7634 7646 +12
Lines 216833 217247 +414
Branches 54183 54328 +145
==========================================
+ Hits 188165 188571 +406
+ Misses 16870 16862 -8
- Partials 11798 11814 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
GitHub rejects paths and paths-ignore on the same pull_request event, so the workflow never queued. Co-authored-by: Cursor <cursoragent@cursor.com>
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
Schema reads and writes use this token, so it must be that installation. Co-authored-by: Cursor <cursoragent@cursor.com>
The gate lists schema pull requests with the Consensys app token. Co-authored-by: Cursor <cursoragent@cursor.com>
github-script already injects getOctokit, so the previous pin failed to start. Co-authored-by: Cursor <cursoragent@cursor.com>
A merge emits closed as well. This job closes the schema draft only for an unmerged close. Co-authored-by: Cursor <cursoragent@cursor.com>
The Consensys app token requests contents, pull requests, and issues write. The agreement jobs set an explicit GITHUB_TOKEN scope. Co-authored-by: Cursor <cursoragent@cursor.com>
joaoloureirop
left a comment
There was a problem hiding this comment.
suggestion (non-blocking): path filter skips JavaScript analytics call sites
This only starts propose and close for app/**/*.ts and app/**/*.tsx. A PR that only edits a .js call site never gets a proposal. analytics.trackEvent is still in JS, for example app/actions/settings/index.js, app/components/UI/AccountOverview/index.js, and app/core/RPCMethods/wallet_addEthereumChain.js.
create does not use this filter, so the agreement comment can still open a schema draft, and closing the client PR unmerged will leave it open.
Could we add app/**/*.js? !**/*.test.* already skips *.test.js. If the pinned action cannot parse JS, a note in the comment above is enough.
- 'app/**/*.ts'
- 'app/**/*.tsx'
- 'app/**/*.js'
- '!**/*.test.*'
- '!**/*.spec.*'
- '!**/__snapshots__/**'
|
@joaoloureirop followup PR on #38133 |
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
<!--
mms-check directive vocabulary — read by
.github/scripts/shared/pr-template-checks.ts
at module load to build the validation plan. Directives are invisible in
rendered
markdown and must NOT be removed or edited without updating the
validator registry.
type=text Section must contain non-placeholder prose.
type=changelog Section must have a valid CHANGELOG entry: line.
type=issue-link Section must have a Fixes:/Closes:/Refs: line with a
value.
type=manual-testing Section must have real testing steps or an explicit
N/A.
type=screenshot Section must have evidence (image/URL) or an explicit
N/A.
type=checklist Section must have all checkboxes consciously checked.
required=true|false Whether a missing/invalid section runs the validator
at all.
blocking=true|false Whether a failure of this check fails the CI
workflow.
Default: false — failures are shown as warnings in the sticky
comment but do not block the PR.
Sections without a directive are checked for structural presence only.
-->
## **Description**
<!-- mms-check: type=text required=true -->
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
`propose` and `close` now start for product `app/**/*.js` as well as
`.ts` and `.tsx`. `!**/*.test.*` already skips `*.test.js`. This covers
JavaScript `analytics.trackEvent` call sites such as
`app/actions/settings/index.js`,
`app/components/UI/AccountOverview/index.js`, and
`app/core/RPCMethods/wallet_addEthereumChain.js`.
This responds to the path-filter review on
#37219 (review).
This branch starts at the head of that pull request and leaves its
branch unchanged.
## **Changelog**
<!-- mms-check: type=changelog required=true blocking=true -->
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
<!-- mms-check: type=issue-link required=true -->
Fixes: followup of
#37219
## **Manual testing steps**
<!-- mms-check: type=manual-testing required=true -->
N/A — workflow path comment only.
## **Screenshots/Recordings**
<!-- mms-check: type=screenshot required=true -->
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
N/A
### **After**
N/A
## **Pre-merge author checklist**
<!-- mms-check: type=checklist required=true -->
<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.
Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [x] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **Pre-merge reviewer checklist**
<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> CI path-filter change only; no runtime or security-sensitive code is
modified.
>
> **Overview**
> Extends the **draft Segment schema PR** workflow so it runs on product
JavaScript under `app/`, not only `.ts` and `.tsx`.
>
> Adds `app/**/*.js` to the `pull_request` `paths` filter in
`draft-segment-schema-pr.yml` and updates the inline comment
accordingly. Existing negated globs (`!**/*.test.*`, etc.) still apply,
so test JS is not included. **`propose`** and **`close`** jobs can now
start when analytics-related JS files change (e.g. legacy
`analytics.trackEvent` call sites).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
88d4352. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
b6afd31
|



Description
Adds a helper workflow that reads analytics TypeScript changes on a pull request and can open one draft pull request on Consensys/segment-schema after the author agrees. It is not a merge gate.
The action is pinned to github-tools v1.21.0 (
5d993ac935eff3f248d2213bb2d6922ce9cb3510).proposeandcloserun only whenapp/**/*.tsorapp/**/*.tsxchanges, excluding tests and snapshots.createruns only after this file is on the default branch.Changelog
CHANGELOG entry: null
Related issues
fixes MCWP-910
related to MCWP-575
Shipped in github-tools v1.21.0.
Manual testing steps
This pull request only adds a workflow file, so
proposedoes not run here.After merge:
app/and includes an analytics event change.proposejob posts one sticky comment and does not open a schema pull request yet.I agree to open a draft Segment schema PR.did-user-agree-to-create-pr, thenis-cross-repo-pr, thencreateopen one draft on Consensys/segment-schema.Screenshots/Recordings
N/A
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Made with Cursor
Note
Medium Risk
Introduces cross-repo GitHub App writes to Consensys/segment-schema and comment-triggered automation; misconfiguration or race conditions could create or close the wrong draft PRs, but it is opt-in and not a merge gate.
Reviewed by Cursor Bugbot for commit 8974db0. Bugbot is set up for automated code reviews on this repo. Configure here.