1414 update :
1515 runs-on : ubuntu-latest
1616 timeout-minutes : 180
17+ strategy :
18+ fail-fast : false
19+ matrix :
20+ network : [polkadot, kusama]
1721 steps :
1822 - uses : actions/checkout@v4
1923 - name : setup node env
@@ -23,22 +27,35 @@ jobs:
2327 cache : ' yarn'
2428 - run : yarn --immutable
2529 - run : yarn update-known-good
26- - run : yarn test -u
30+ - run : yarn test:${{ matrix.network }} -u
2731 - name : Commit and Create PR
2832 uses : actions/github-script@v6
2933 with :
3034 script : |
31- const branchName = `update-snapshots-${context.sha.slice(0, 7)}`
32- await exec.exec(`git config --global user.name 'github-actions[bot]'`)
33- await exec.exec(`git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'"`)
34- await exec.exec(`git checkout -b ${branchName}`)
35- await exec.exec(`git`, ['commit', '-am', 'update snapshots'])
36- await exec.exec(`git push origin HEAD:${branchName}`)
35+ const { network } = context.payload.inputs || { network: '${{ matrix.network }}' };
36+ const branchName = `update-snapshots-${network}-${context.sha.slice(0, 7)}`;
37+ const upperNetwork = network.toUpperCase();
38+
39+ await exec.exec(`git config --global user.name 'github-actions[bot]'`);
40+ await exec.exec(`git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'`);
41+
42+ const { stdout: status } = await exec.getExecOutput('git', ['status', '--porcelain']);
43+ if (!status) {
44+ console.log('No changes to commit.');
45+ return;
46+ }
47+
48+ await exec.exec(`git checkout -b ${branchName}`);
49+ await exec.exec('git', ['add', '-A', `packages/${network}`]);
50+ await exec.exec('git', ['add', '-A', `KNOWN_GOOD_BLOCK_NUMBERS_${upperNetwork}.env`]);
51+ await exec.exec('git', ['commit', '-m', `Update snapshots for ${network}`]);
52+ await exec.exec(`git push origin HEAD:${branchName}`);
53+
3754 await github.rest.pulls.create({
3855 owner: context.repo.owner,
3956 repo: context.repo.repo,
40- title: ' Update Snapshots' ,
57+ title: ` Update Snapshots for ${network}` ,
4158 head: branchName,
4259 base: 'master',
43- body: ' Update Snapshots\n\nClose and reopen this PR to trigger CI.' ,
44- })
60+ body: ` Update Snapshots for ${network} \n\nClose and reopen this PR to trigger CI.` ,
61+ });
0 commit comments