Skip to content

Commit

Permalink
Merge branch 'caip-multichain' into jl/caip-multichain/fix-provider-r…
Browse files Browse the repository at this point in the history
…equest-scopeObject-check
  • Loading branch information
jiexi committed Jul 18, 2024
2 parents b691681 + a1b1707 commit 6670adc
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ aliases:
workflows:
test_and_release:
when:
not:
matches:
pattern: /^l10n_crowdin_action$/
value: << pipeline.git.branch >>
jobs:
- create_release_pull_request:
<<: *rc_branch_only
Expand Down Expand Up @@ -362,6 +367,27 @@ workflows:
requires:
- prep-build-ts-migration-dashboard

locales_only:
when:
matches:
pattern: /^l10n_crowdin_action$/
value: << pipeline.git.branch >>
jobs:
- prep-deps
- get-changed-files-with-git-diff:
requires:
- prep-deps
- validate-locales-only:
requires:
- get-changed-files-with-git-diff
- test-lint:
requires:
- prep-deps
- all-tests-pass:
requires:
- test-lint
- validate-locales-only

jobs:
trigger-beta-build:
executor: node-browsers-small
Expand Down Expand Up @@ -499,6 +525,15 @@ jobs:
paths:
- changed-files

validate-locales-only:
executor: node-browsers-small
steps:
- run: *shallow-git-clone
- run: sudo corepack enable
- attach_workspace:
at: .
- run: yarn tsx .circleci/scripts/validate-locales-only.ts

validate-lavamoat-allow-scripts:
executor: node-browsers-small
steps:
Expand Down
31 changes: 31 additions & 0 deletions .circleci/scripts/validate-locales-only.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { readChangedFiles } = require('../../test/e2e/changedFilesUtil.js');

/**
* Verifies that all changed files are in the /_locales/ directory.
* Fails the build if any changed files are outside of the /_locales/ directory.
* Fails if no changed files are detected.
*/
async function validateLocalesOnlyChangedFiles() {
const changedFiles = await readChangedFiles();
if (!changedFiles || changedFiles.length === 0) {
console.error('Failure: No changed files detected.');
process.exit(1);
}
const invalidFiles = changedFiles.filter(
(file) => !file.startsWith('app/_locales/'),
);
if (invalidFiles.length > 0) {
console.error(
'Failure: Changed files must be in the /_locales/ directory.\n Changed Files:',
changedFiles,
'\n Invalid Files:',
invalidFiles,
);
process.exit(1);
} else {
console.log('Passed validation');
process.exit(0);
}
}

validateLocalesOnlyChangedFiles();
2 changes: 1 addition & 1 deletion test/e2e/changedFilesUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ async function filterE2eChangedFiles() {
return e2eChangedFiles;
}

module.exports = { filterE2eChangedFiles };
module.exports = { filterE2eChangedFiles, readChangedFiles };

0 comments on commit 6670adc

Please sign in to comment.