Commit 0ee635f
chore: code fencing for gh actions defined at builds.yml (MetaMask#26159)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
Wire Metro’s code-fence removal to **builds.yml** on GitHub Actions
while keeping Bitrise/local behavior unchanged.
**Why:** On GH Actions, build config (and thus which features are
enabled) comes from `builds.yml` via `apply-build-config.js`, which can
set `CODE_FENCING_FEATURES`. Metro previously only used
`METAMASK_BUILD_TYPE` and `METAMASK_ENVIRONMENT`, so code fencing did
not follow the same source of truth.
**What changed:**
- **GH Actions:** When `CODE_FENCING_FEATURES` is set, Metro uses that
JSON array for code-fence removal; `INCLUDE_SAMPLE_FEATURE` still adds
`sample-feature` when set.
- **Bitrise/local:** When `CODE_FENCING_FEATURES` is not set, behavior
is unchanged: features are derived from `METAMASK_BUILD_TYPE` +
`METAMASK_ENVIRONMENT` via `getBuildTypeFeaturesFromEnv()`.
- **Safety:** The env-based fallback returns new `Set` instances so
adding `sample-feature` (or other mutations) does not mutate shared
global sets.
- **Docs:** Comments and JSDoc clarify the “legacy” (Bitrise/local) vs
“GH Actions” paths.
**Scope:** Only `metro.transform.js` (no workflow or script changes in
this PR).
---
## **Changelog**
<!--
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: Added code fencing for gh actions defined at builds.yml
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
checking code fencing in all builds ✅
main-rc
<img width="280" height="675" alt="main-test"
src="https://github.com/user-attachments/assets/75d11555-3f76-4f80-bb48-c6a45cb99d64"
/>
main-exp
<img width="280" height="675" alt="main-test"
src="https://github.com/user-attachments/assets/04487ad6-359c-448c-9660-f2e139f88dbf"
/>
main-test
<img width="280" height="675" alt="main-test"
src="https://github.com/user-attachments/assets/319eb592-691f-4abe-93f3-f3a0467ac0bc"
/>
main-beta
<img width="280" height="675" alt="main-test"
src="https://github.com/user-attachments/assets/c38416cb-706f-488f-a031-bcac2d811d8c"
/>
flask-test
<img width="280" height="675" alt="main-test"
src="https://github.com/user-attachments/assets/12224fd6-6ac2-4726-b7f4-43ca10ea2f59"
/>
## **Pre-merge author checklist**
- [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.
## **Pre-merge reviewer checklist**
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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]
> **Medium Risk**
> Changes the source of truth for code-fence feature gating in CI
builds, so misconfigured `CODE_FENCING_FEATURES` could include/exclude
fenced code unexpectedly across release flavors.
>
> **Overview**
> Metro’s code-fence removal now **prefers `CODE_FENCING_FEATURES` (JSON
from `builds.yml` via CI)** as the active feature set, falling back to
the prior `METAMASK_BUILD_TYPE`/`METAMASK_ENVIRONMENT` logic when unset.
>
> `builds.yml` expands code-fencing anchors to explicitly define `beta`
and `experimental` feature sets, and updates the `main-beta` and
`main-exp` build configs to use them; the Metro fallback path also now
returns fresh `Set` instances to avoid mutating shared feature sets when
optionally adding `sample-feature`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c474217. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Wei Sun <wei.sun@consensys.net>1 parent d80bfbd commit 0ee635f
2 files changed
Lines changed: 59 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
123 | 143 | | |
124 | 144 | | |
125 | 145 | | |
| |||
186 | 206 | | |
187 | 207 | | |
188 | 208 | | |
189 | | - | |
| 209 | + | |
190 | 210 | | |
191 | 211 | | |
192 | 212 | | |
| |||
260 | 280 | | |
261 | 281 | | |
262 | 282 | | |
263 | | - | |
| 283 | + | |
264 | 284 | | |
265 | 285 | | |
266 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
56 | | - | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | | - | |
61 | | - | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | | - | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | | - | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
76 | 76 | | |
77 | | - | |
78 | | - | |
| 77 | + | |
79 | 78 | | |
80 | 79 | | |
81 | | - | |
| 80 | + | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
96 | 119 | | |
97 | | - | |
| 120 | + | |
98 | 121 | | |
99 | 122 | | |
100 | | - | |
| 123 | + | |
101 | 124 | | |
102 | 125 | | |
103 | 126 | | |
| |||
0 commit comments