Skip to content

Commit e597d0b

Browse files
authored
Merge branch 'main' into update-create-service-policy
2 parents 3d8da80 + 775ce93 commit e597d0b

76 files changed

Lines changed: 3304 additions & 1139 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/check-release/action.yml

Lines changed: 137 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,73 @@
11
name: Check release
22
description: Check for conflicts in packages being released in this PR.
33

4-
inputs:
5-
pull-request:
6-
description: 'The pull request number to get changed files from.'
7-
required: true
8-
94
runs:
105
using: composite
116
steps:
127
- name: Checkout repository
13-
uses: actions/checkout@v4
8+
uses: actions/checkout@v5
9+
with:
10+
fetch-depth: 0
11+
12+
- name: Get merge base
13+
id: merge-base
14+
shell: bash
15+
env:
16+
BASE_REF: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }}
17+
run: |
18+
set -euo pipefail
19+
20+
# Strip invalid prefix from `github.event.merge_group.base_ref`
21+
# It comes prefixed with `refs/heads/`, but the branch is not checked out in this context
22+
# We need to express it as a remote branch
23+
PREFIXED_REF_REGEX='refs/heads/(.+)'
24+
if [[ "$BASE_REF" =~ $PREFIXED_REF_REGEX ]]; then
25+
BASE_REF="${BASH_REMATCH[1]}"
26+
fi
27+
28+
MERGE_BASE=$(git merge-base HEAD "refs/remotes/origin/$BASE_REF")
29+
echo "MERGE_BASE=$MERGE_BASE" >> "$GITHUB_OUTPUT"
30+
31+
- name: Check if the commit or pull request is a release
32+
id: is-release
33+
uses: MetaMask/action-is-release@v2
34+
with:
35+
commit-starts-with: 'Release [version],Release v[version],Release/[version],Release/v[version],Release `[version]`'
36+
commit-message: ${{ github.event.pull_request.title }}
37+
before: ${{ steps.merge-base.outputs.MERGE_BASE }}
38+
39+
# `action-is-release` checks out the repository with `fetch-depth: 2`, so we
40+
# need to check it out again with full history.
41+
- name: Checkout repository
42+
uses: actions/checkout@v5
43+
if: steps.is-release.outputs.IS_RELEASE == 'true'
1444
with:
1545
fetch-depth: 0
1646

47+
- name: Get pull request number
48+
id: pr-number
49+
if: steps.is-release.outputs.IS_RELEASE == 'true'
50+
shell: bash
51+
env:
52+
EVENT_NAME: ${{ github.event_name }}
53+
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
54+
MERGE_GROUP_HEAD_REF: ${{ github.event.merge_group.head_ref }}
55+
run: |
56+
if [ "$EVENT_NAME" = "pull_request" ]; then
57+
echo "PR_NUMBER=$PULL_REQUEST_NUMBER" >> "$GITHUB_OUTPUT"
58+
elif [ "$EVENT_NAME" = "merge_group" ]; then
59+
PR_NUMBER_REGEX='/pr-([0-9]+)-'
60+
if [[ "$MERGE_GROUP_HEAD_REF" =~ $PR_NUMBER_REGEX ]]; then
61+
echo "PR_NUMBER=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
62+
else
63+
echo "::error::Could not extract PR number from merge group head ref: $MERGE_GROUP_HEAD_REF."
64+
exit 1
65+
fi
66+
fi
67+
1768
- name: Get target reference
1869
id: get-target
70+
if: steps.is-release.outputs.IS_RELEASE == 'true'
1971
shell: bash
2072
env:
2173
EVENT_NAME: ${{ github.event_name }}
@@ -30,14 +82,15 @@ runs:
3082
fi
3183
3284
- name: Check commits for changes in released packages
85+
id: check-release
86+
if: steps.is-release.outputs.IS_RELEASE == 'true'
3387
shell: bash
3488
env:
3589
GH_TOKEN: ${{ github.token }}
36-
PULL_REQUEST: ${{ inputs.pull-request }}
90+
PULL_REQUEST: ${{ steps.pr-number.outputs.PR_NUMBER }}
3791
TARGET: ${{ steps.get-target.outputs.TARGET }}
3892
run: |
3993
set -euo pipefail
40-
git fetch origin main
4194
4295
mapfile -t PACKAGES < <(find packages -maxdepth 2 -name "package.json" -not -path "*/node_modules/*")
4396
RELEASED_PACKAGES=()
@@ -61,7 +114,7 @@ runs:
61114
git fetch origin "$PULL_REQUEST_BRANCH"
62115
63116
# Get all files changed ahead of this PR.
64-
BEFORE=$(git merge-base "refs/remotes/origin/main" "origin/$PULL_REQUEST_BRANCH")
117+
BEFORE=$(git merge-base "refs/remotes/origin/main" "refs/remotes/origin/$PULL_REQUEST_BRANCH")
65118
git diff --name-only "$BEFORE..$TARGET" > changed-files.txt
66119
67120
CONFLICTS=()
@@ -77,11 +130,85 @@ runs:
77130
fi
78131
79132
if [ ${#CONFLICTS[@]} -ne 0 ]; then
133+
PACKAGE_NAMES=()
134+
80135
for conflict in "${CONFLICTS[@]}"; do
81136
package_name=$(jq -r ".name" "$conflict/package.json")
137+
PACKAGE_NAMES+=("$package_name")
82138
echo "::error::Release conflict detected in \`$package_name\`. This package is being released in this PR, but files in the package were also modified ahead of this PR. Please ensure that all changes are included in the release."
83139
done
84-
exit 1
140+
141+
PACKAGE_NAMES_JSON=$(printf '%s\n' "${PACKAGE_NAMES[@]}" | jq -R . | jq -s -c .)
142+
echo "package-names=$PACKAGE_NAMES_JSON" >> "$GITHUB_OUTPUT"
143+
echo "has-conflicts=true" >> "$GITHUB_OUTPUT"
85144
else
86145
echo "✅ No release conflicts detected."
87146
fi
147+
148+
- name: Hide previous comments
149+
if: steps.is-release.outputs.IS_RELEASE == 'true'
150+
uses: actions/github-script@v8
151+
env:
152+
PR_NUMBER: ${{ steps.pr-number.outputs.PR_NUMBER }}
153+
with:
154+
script: |
155+
const comments = await github.paginate(github.rest.issues.listComments, {
156+
owner: context.repo.owner,
157+
repo: context.repo.repo,
158+
issue_number: process.env.PR_NUMBER,
159+
});
160+
161+
for (const comment of comments) {
162+
if (comment.body.includes('<!-- Pull request release conflict comment -->')) {
163+
await github.graphql(`
164+
mutation($commentId: ID!, $classifier: ReportedContentClassifiers!) {
165+
minimizeComment(input: {subjectId: $commentId, classifier: $classifier}) {
166+
minimizedComment {
167+
isMinimized
168+
}
169+
}
170+
}
171+
`, {
172+
commentId: comment.node_id,
173+
classifier: 'OUTDATED',
174+
});
175+
}
176+
}
177+
178+
- name: Reply on pull request
179+
if: steps.check-release.outputs.has-conflicts == 'true'
180+
uses: actions/github-script@v8
181+
env:
182+
PACKAGE_NAMES: ${{ steps.check-release.outputs.package-names }}
183+
PR_NUMBER: ${{ steps.pr-number.outputs.PR_NUMBER }}
184+
with:
185+
script: |
186+
const packageNames = JSON.parse(process.env.PACKAGE_NAMES);
187+
const packageList = packageNames.map(name => `- \`${name}\``).join('\n');
188+
189+
const mergeQueueNote = context.eventName === 'merge_group' ? ' while this pull request was in the merge queue' : '';
190+
191+
const body = `
192+
## Release conflict detected
193+
194+
The following packages are being released in this pull request, but files in these packages were also modified ahead of this pull request${mergeQueueNote}:
195+
196+
${packageList}
197+
198+
Please ensure that all changes are included in the release by updating this pull request, and adjusting the changelogs and version bumps as necessary.
199+
200+
<!-- Pull request release conflict comment -->
201+
`;
202+
203+
await github.rest.issues.createComment({
204+
owner: context.repo.owner,
205+
repo: context.repo.repo,
206+
issue_number: process.env.PR_NUMBER,
207+
body: body.split('\n').map(line => line.trim()).join('\n'),
208+
});
209+
210+
- name: Fail if conflicts found
211+
if: steps.check-release.outputs.has-conflicts == 'true'
212+
shell: bash
213+
run: |
214+
exit 1

.github/workflows/ensure-blocking-pr-labels-absent.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ on:
66
- synchronize
77
- labeled
88
- unlabeled
9+
merge_group:
910

1011
jobs:
1112
ensure-blocking-pr-labels-absent:
13+
if: ${{ github.event_name != 'merge_group' }} # Skip this step for merge_group events
1214
runs-on: ubuntu-latest
1315
permissions:
1416
pull-requests: read

.github/workflows/lint-build-test.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,28 @@ jobs:
9292
exit 1
9393
fi
9494
95+
test-scripts:
96+
name: Test Scripts
97+
runs-on: ubuntu-latest
98+
needs: prepare
99+
strategy:
100+
matrix:
101+
node-version: [22.x]
102+
steps:
103+
- name: Checkout and setup environment
104+
uses: MetaMask/action-checkout-and-setup@v2
105+
with:
106+
is-high-risk-environment: false
107+
node-version: ${{ matrix.node-version }}
108+
- run: yarn test:scripts
109+
- name: Require clean working directory
110+
shell: bash
111+
run: |
112+
if ! git diff --exit-code; then
113+
echo "Working tree dirty at end of job"
114+
exit 1
115+
fi
116+
95117
test:
96118
name: Test
97119
runs-on: ubuntu-latest
@@ -106,7 +128,6 @@ jobs:
106128
with:
107129
is-high-risk-environment: false
108130
node-version: ${{ matrix.node-version }}
109-
- run: yarn test:scripts
110131
- run: yarn workspace ${{ matrix.package-name }} run test
111132
- name: Require clean working directory
112133
shell: bash

.github/workflows/main.yml

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -67,54 +67,15 @@ jobs:
6767
name: Check release
6868
needs: check-workflows
6969
runs-on: ubuntu-latest
70+
permissions:
71+
contents: read
72+
pull-requests: write
7073
steps:
7174
- name: Checkout repository
7275
uses: actions/checkout@v5
73-
with:
74-
fetch-depth: 0
75-
76-
- name: Get merge base
77-
id: merge-base
78-
if: github.event_name != 'push'
79-
env:
80-
BASE_REF: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }}
81-
run: |
82-
echo "MERGE_BASE=$(git merge-base HEAD "refs/remotes/origin/$BASE_REF")" >> "$GITHUB_OUTPUT"
83-
84-
- name: Check if the commit or pull request is a release
85-
id: is-release
86-
if: github.event_name != 'push'
87-
uses: MetaMask/action-is-release@v2
88-
with:
89-
commit-starts-with: 'Release [version],Release v[version],Release/[version],Release/v[version],Release `[version]`'
90-
commit-message: ${{ github.event.pull_request.title }}
91-
before: ${{ steps.merge-base.outputs.MERGE_BASE }}
92-
93-
- name: Get pull request number
94-
if: github.event_name != 'push'
95-
id: pr-number
96-
env:
97-
EVENT_NAME: ${{ github.event_name }}
98-
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
99-
MERGE_GROUP_HEAD_REF: ${{ github.event.merge_group.head_ref }}
100-
run: |
101-
if [ "$EVENT_NAME" = "pull_request" ]; then
102-
echo "PR_NUMBER=$PULL_REQUEST_NUMBER" >> "$GITHUB_OUTPUT"
103-
elif [ "$EVENT_NAME" = "merge_group" ]; then
104-
PR_NUMBER_REGEX='/pr-([0-9]+)-'
105-
if [[ "$MERGE_GROUP_HEAD_REF" =~ $PR_NUMBER_REGEX ]]; then
106-
echo "PR_NUMBER=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
107-
else
108-
echo "::error::Could not extract PR number from merge group head ref: $MERGE_GROUP_HEAD_REF."
109-
exit 1
110-
fi
111-
fi
112-
11376
- name: Check release
114-
if: github.event_name != 'push' && steps.is-release.outputs.IS_RELEASE == 'true'
77+
if: github.event_name != 'push'
11578
uses: ./.github/actions/check-release
116-
with:
117-
pull-request: ${{ steps.pr-number.outputs.PR_NUMBER }}
11879

11980
is-release:
12081
name: Determine whether this is a release merge commit

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/core-monorepo",
3-
"version": "680.0.0",
3+
"version": "683.0.0",
44
"private": true,
55
"description": "Monorepo for packages shared between MetaMask clients",
66
"repository": {

packages/assets-controllers/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [89.0.0]
11+
12+
### Changed
13+
14+
- **BREAKING:** Remove fallback to CryptoCompare on `CurrencyRatesController` and `TokenRatesController` ([#7167](https://github.com/MetaMask/core/pull/7167))
15+
- Bump `@metamask/core-backend` from `^4.0.0` to `^4.1.0`
16+
1017
### Fixed
1118

1219
- Enable RPC fallback when Accounts API fails or times out in `TokenBalancesController` ([#7155](https://github.com/MetaMask/core/pull/7155))
@@ -2279,7 +2286,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
22792286
22802287
- Use Ethers for AssetsContractController ([#845](https://github.com/MetaMask/core/pull/845))
22812288
2282-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@88.0.0...HEAD
2289+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@89.0.0...HEAD
2290+
[89.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@88.0.0...@metamask/assets-controllers@89.0.0
22832291
[88.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@87.1.1...@metamask/assets-controllers@88.0.0
22842292
[87.1.1]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@87.1.0...@metamask/assets-controllers@87.1.1
22852293
[87.1.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@87.0.0...@metamask/assets-controllers@87.1.0

packages/assets-controllers/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/assets-controllers",
3-
"version": "88.0.0",
3+
"version": "89.0.0",
44
"description": "Controllers which manage interactions involving ERC-20, ERC-721, and ERC-1155 tokens (including NFTs)",
55
"keywords": [
66
"MetaMask",
@@ -86,7 +86,7 @@
8686
"@metamask/accounts-controller": "^34.0.0",
8787
"@metamask/approval-controller": "^8.0.0",
8888
"@metamask/auto-changelog": "^3.4.4",
89-
"@metamask/core-backend": "^4.0.0",
89+
"@metamask/core-backend": "^4.1.0",
9090
"@metamask/ethjs-provider-http": "^0.3.0",
9191
"@metamask/keyring-controller": "^24.0.0",
9292
"@metamask/keyring-internal-api": "^9.0.0",
@@ -118,7 +118,7 @@
118118
"@metamask/account-tree-controller": "^3.0.0",
119119
"@metamask/accounts-controller": "^34.0.0",
120120
"@metamask/approval-controller": "^8.0.0",
121-
"@metamask/core-backend": "^4.0.0",
121+
"@metamask/core-backend": "^4.1.0",
122122
"@metamask/keyring-controller": "^24.0.0",
123123
"@metamask/network-controller": "^25.0.0",
124124
"@metamask/permission-controller": "^12.0.0",

0 commit comments

Comments
 (0)