Skip to content

Commit 37537ca

Browse files
committed
Merge branch 'master' of github.com:FuelLabs/fuels-wallet into ag/fe/feat-1205
2 parents a3c38a8 + 20042d8 commit 37537ca

30 files changed

+715
-362
lines changed

.changeset/brown-wasps-swim.md

-6
This file was deleted.

.changeset/friendly-lemons-carry.md

-5
This file was deleted.

.changeset/lucky-pets-brake.md

-5
This file was deleted.

.changeset/moody-eggs-hope.md

-5
This file was deleted.

.changeset/unlucky-vans-invent.md

-5
This file was deleted.

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @luizstacio @LuizAsFight @helciofranco @arthurgeron @rodrigobranas @nelitow
1+
* @luizstacio @LuizAsFight

.github/pull_request_template.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Please provide a summary of your changes if they are not self-explanatory from t
1111

1212
# Checklist
1313

14-
- [ ] I've added error handling for all actions/requests.
15-
- [ ] I've reviewed how my changes will display in the UI.
16-
- [ ] I've checked all the copy (text) changes or additions in this PR.
17-
- [ ] I've included references to the issues being closed on GitHub and/or Linear.
18-
- [ ] I've ensured that the documentation is up to date and reflects any changes.
19-
- [ ] I've added documentation links where it may be helpful.
20-
- [ ] I **reviewed** the **entire PR** myself.
14+
- [ ] I've added error handling for all actions/requests, and verified how this error will show on UI. (or there was no error handling)
15+
- [ ] I've reviewed all the copy changed/added in this PR, using AI if needed. (or there was no copy changes)
16+
- [ ] I've included the reference to the issues being closed from Github and/or Linear (or there was no issues)
17+
- [ ] I've changed the Docs to reflect my changes (or it was not needed)
18+
- [ ] I've put docs links where it may be helpful (or it was not needed)
19+
- [ ] I checked the resulting UI both in Light and Dark mode (or no UI changes were made)
20+
- [ ] I **reviewed** the **entire PR** myself (preferably, on GH UI)

.github/workflows/pr.yaml

+3-180
Original file line numberDiff line numberDiff line change
@@ -59,186 +59,6 @@ jobs:
5959
- name: Validate Changeset
6060
run: pnpm changeset status --since=origin/${{ github.base_ref }}
6161

62-
validate-checklist:
63-
name: Validate PR Checklist Completion
64-
runs-on: ubuntu-latest
65-
steps:
66-
- name: Checkout code
67-
uses: actions/checkout@v4
68-
with:
69-
fetch-depth: 0
70-
- name: Check that all checklist items are complete
71-
uses: actions/github-script@v6
72-
with:
73-
script: |
74-
(async () => {
75-
const fs = require('fs');
76-
const path = require('path');
77-
const marker = "<!-- validation-comment -->";
78-
79-
// Get PR details
80-
const pr = context.payload.pull_request;
81-
const prBody = pr.body || "";
82-
83-
// Load the checklist template from the current checkout, or fallback to the GitHub API.
84-
let templateContent = "";
85-
const templateFilePath = path.join(process.cwd(), ".github/pull_request_template.md");
86-
if (fs.existsSync(templateFilePath)) {
87-
templateContent = fs.readFileSync(templateFilePath, { encoding: "utf8" });
88-
} else {
89-
const response = await github.rest.repos.getContent({
90-
owner: context.repo.owner,
91-
repo: context.repo.repo,
92-
path: ".github/pull_request_template.md",
93-
});
94-
const buff = Buffer.from(response.data.content, 'base64');
95-
templateContent = buff.toString('utf8');
96-
}
97-
98-
// Count the checklist items in the template and the checkmarked items in the PR
99-
const expectedCount = (templateContent.match(/-\s*\[\s*\]/g) || []).length;
100-
const checkedCount = (prBody.match(/-\s*\[[xX]\]/g) || []).length;
101-
102-
if (checkedCount < expectedCount) {
103-
const errorMessage = `${marker}❌ Incomplete checklist: expected ${expectedCount} completed items, but found ${checkedCount}. Please complete all checklist items in the PR template.`;
104-
105-
// List all comments and look for an existing error comment.
106-
const { data: comments } = await github.rest.issues.listComments({
107-
owner: context.repo.owner,
108-
repo: context.repo.repo,
109-
issue_number: pr.number,
110-
});
111-
const existingComment = comments.find(comment => comment.body && comment.body.includes(marker));
112-
113-
if (existingComment) {
114-
await github.rest.issues.updateComment({
115-
owner: context.repo.owner,
116-
repo: context.repo.repo,
117-
comment_id: existingComment.id,
118-
body: errorMessage,
119-
});
120-
} else {
121-
await github.rest.issues.createComment({
122-
owner: context.repo.owner,
123-
repo: context.repo.repo,
124-
issue_number: pr.number,
125-
body: errorMessage,
126-
});
127-
}
128-
throw new Error(errorMessage);
129-
} else {
130-
// If the checklist is complete, remove any existing error comment.
131-
const { data: comments } = await github.rest.issues.listComments({
132-
owner: context.repo.owner,
133-
repo: context.repo.repo,
134-
issue_number: pr.number,
135-
});
136-
const existingComment = comments.find(comment => comment.body && comment.body.includes(marker));
137-
if (existingComment) {
138-
await github.rest.issues.deleteComment({
139-
owner: context.repo.owner,
140-
repo: context.repo.repo,
141-
comment_id: existingComment.id,
142-
});
143-
}
144-
console.log("All checklist items have been completed.");
145-
}
146-
})().catch(error => {
147-
console.error(error);
148-
throw error;
149-
});
150-
verify-issue-reference:
151-
name: Validate PR Issue References
152-
runs-on: ubuntu-latest
153-
steps:
154-
- name: Check for GitHub and Linear issue references
155-
uses: actions/github-script@v6
156-
with:
157-
script: |
158-
(async () => {
159-
const pr = context.payload.pull_request;
160-
const prBody = pr.body || "";
161-
// Regex for a GitHub issue reference, for example "Closes #123"
162-
const githubIssueRegex = /#\d+/;
163-
// Regex for a Linear issue reference, for example "FE-123"
164-
const linearIssueRegex = /FE-\d+/;
165-
166-
const githubIssueMatch = prBody.match(githubIssueRegex);
167-
const linearIssueMatch = prBody.match(linearIssueRegex);
168-
let missingRefs = [];
169-
170-
if (!githubIssueMatch) {
171-
missingRefs.push("GitHub Issue (e.g., Closes #123)");
172-
}
173-
if (!linearIssueMatch) {
174-
missingRefs.push("Linear Issue (e.g., FE-123)");
175-
}
176-
177-
if (missingRefs.length > 0) {
178-
const marker = "<!-- validation-comment -->";
179-
const errorMessage = `${marker}❌ Missing required references: " + missingRefs.join(" and ") + ". Please include both a GitHub and a Linear issue reference in your PR description.`;
180-
// Add a comment in the PR conversation
181-
// List all comments and look for an existing error comment.
182-
const { data: comments } = await github.rest.issues.listComments({
183-
owner: context.repo.owner,
184-
repo: context.repo.repo,
185-
issue_number: pr.number,
186-
});
187-
const existingComment = comments.find(comment => comment.body && comment.body.includes(marker));
188-
189-
if (existingComment) {
190-
await github.rest.issues.updateComment({
191-
owner: context.repo.owner,
192-
repo: context.repo.repo,
193-
comment_id: existingComment.id,
194-
body: errorMessage,
195-
});
196-
} else {
197-
await github.rest.issues.createComment({
198-
owner: context.repo.owner,
199-
repo: context.repo.repo,
200-
issue_number: pr.number,
201-
body: errorMessage,
202-
});
203-
}
204-
throw new Error("Missing required issue references in the PR description.");
205-
} else {
206-
console.log("Both GitHub and Linear issue references are present in the PR.");
207-
}
208-
})().catch(error => {
209-
console.error(error);
210-
throw error;
211-
});
212-
213-
cleanup-gh-comments:
214-
name: Remove validation comments
215-
runs-on: ubuntu-latest
216-
needs: [validate-checklist, verify-issue-reference]
217-
steps:
218-
- name: Remove checklist and reference validation comments
219-
uses: actions/github-script@v6
220-
with:
221-
script: |
222-
(async () => {
223-
const pr = context.payload.pull_request;
224-
const { data: comments } = await github.rest.issues.listComments({
225-
owner: context.repo.owner,
226-
repo: context.repo.repo,
227-
issue_number: pr.number,
228-
});
229-
const marker = "<!-- validation-comment -->";
230-
const errorComments = comments.filter(comment => comment.body && comment.body.includes(marker));
231-
for (const comment of errorComments) {
232-
await github.rest.issues.deleteComment({
233-
owner: context.repo.owner,
234-
repo: context.repo.repo,
235-
comment_id: comment.id,
236-
});
237-
}
238-
})().catch(error => {
239-
console.error(error);
240-
throw error;
241-
});
24262
audit:
24363
name: Audit
24464
runs-on: ubuntu-latest
@@ -296,16 +116,19 @@ jobs:
296116
steps:
297117
- name: Checkout
298118
uses: actions/checkout@v4
119+
299120
- name: Extract pnpm version from .tool-versions
300121
id: get_pnpm
301122
run: |
302123
PNPM_VERSION=$(grep '^pnpm' .tool-versions | awk '{print $2}')
303124
echo "PNPM_VERSION=${PNPM_VERSION}" >> $GITHUB_ENV
125+
304126
- name: Setup Node
305127
uses: FuelLabs/github-actions/setups/node@master
306128
with:
307129
node-version: 20.11.0
308130
pnpm-version: ${{ env.PNPM_VERSION }}
131+
309132
- name: Run lint
310133
run: |
311134
pnpm ts:check

.github/workflows/release-npm-changeset.yaml

+77-17
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,84 @@ env:
1313
BUILD_VERSION: ""
1414

1515
jobs:
16-
release-changesets:
17-
name: Release master or rc
16+
check-commit:
17+
name: Decide if releases or create PR
1818
runs-on: buildjet-4vcpu-ubuntu-2204
19+
permissions:
20+
contents: read
21+
pull-requests: read
22+
outputs:
23+
is_changeset_pr: ${{ steps.check-commit.outputs.is_changeset_pr }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
- id: check-commit
29+
name: Check if this commit is a regular merge or a changeset PR merge
30+
env:
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
COMMIT_MSG=$(git log -1 --pretty=%B)
34+
FIRST_LINE=$(echo "$COMMIT_MSG" | head -n1)
35+
if [[ "$FIRST_LINE" == "ci(changesets): versioning packages"* ]]; then
36+
PR_NUMBER=$(echo "$FIRST_LINE" | grep -o '#[0-9]\+' | head -n1 | tr -d '#')
37+
if [ -n "$PR_NUMBER" ]; then
38+
PR_TITLE=$(gh pr view "$PR_NUMBER" --json title -q .title)
39+
if [[ "$PR_TITLE" == "ci(changesets): versioning packages" ]]; then
40+
echo "is_changeset_pr=true" >> "$GITHUB_OUTPUT"
41+
exit 0
42+
fi
43+
fi
44+
fi
45+
echo "is_changeset_pr=false" >> "$GITHUB_OUTPUT"
46+
47+
create-pr:
48+
name: Push changes to Changeset PR
49+
needs: check-commit
50+
if: needs.check-commit.outputs.is_changeset_pr == 'false'
51+
runs-on: buildjet-4vcpu-ubuntu-2204
52+
permissions:
53+
contents: write
54+
pull-requests: write
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 0
59+
persist-credentials: false
60+
- name: Extract pnpm version from .tool-versions
61+
id: get_pnpm
62+
run: |
63+
PNPM_VERSION=$(grep '^pnpm' .tool-versions | awk '{print $2}')
64+
echo "PNPM_VERSION=${PNPM_VERSION}" >> $GITHUB_ENV
65+
- uses: FuelLabs/github-actions/setups/node@master
66+
with:
67+
node-version: 20.11.0
68+
pnpm-version: ${{ env.PNPM_VERSION }}
69+
70+
- name: Setup git user (for changelog step)
71+
run: |
72+
git config --global user.name "${{ github.actor }}"
73+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
74+
75+
- name: Create Changeset PR
76+
uses: changesets/action@v1
77+
with:
78+
commit: "ci(changesets): versioning packages"
79+
title: "ci(changesets): versioning packages"
80+
createGithubReleases: false
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
84+
publish-npm:
85+
name: Release to NPM
86+
needs: check-commit
87+
if: needs.check-commit.outputs.is_changeset_pr == 'true'
88+
runs-on: ubuntu-latest
89+
environment: npm-deploy
1990
steps:
2091
- uses: actions/checkout@v4
2192
with:
22-
# need this to get full git-history/clone in order to build changelogs and check changesets
2393
fetch-depth: 0
24-
# workaround to ensure force pushes to changeset branch use REPO_TOKEN owner's account
25-
# see https://github.com/changesets/action/issues/70
2694
persist-credentials: false
2795
- name: Extract pnpm version from .tool-versions
2896
id: get_pnpm
@@ -45,27 +113,19 @@ jobs:
45113
env:
46114
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47115

48-
- name: Setup git user (for changelog step)
49-
run: |
50-
git config --global user.name "${{ github.actor }}"
51-
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
52-
53116
- name: Build packages
54117
run: pnpm build:libs
55118

56-
- name: Create Release Pull Request or Publish to NPM
119+
- name: Publish to NPM
57120
id: changesets
58121
uses: FuelLabs/changesets-action@v2.0.0
59122
with:
60123
publish: pnpm changeset publish --tag next
61-
commit: "ci(changesets): versioning packages"
62-
title: "ci(changesets): versioning packages"
63124
createGithubReleases: aggregate
64-
githubReleaseName: v${{ env.BUILD_VERSION }}
65-
githubTagName: v${{ env.BUILD_VERSION }}
125+
version: pnpm changeset version
66126
env:
67-
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
68-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
NPM_TOKEN: ${{ secrets.NPM_TOKEN_WALLET }}
69129

70130
- name: Build Fuel Wallet
71131
if: steps.changesets.outputs.published == 'true'

0 commit comments

Comments
 (0)