Skip to content

Commit c75ae25

Browse files
clydinalan-agius4
authored andcommitted
ci: use CircleCI pipeline SHA variables for commit validation
1 parent 55e19aa commit c75ae25

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

.circleci/config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,14 @@ jobs:
166166
executor: action-executor
167167
steps:
168168
- custom_attach_workspace
169-
- run: yarn validate --ci
169+
- run:
170+
name: Validate Commit Messages
171+
command: yarn -s admin validate-commits --base <<pipeline.git.base_revision>> --head <<pipeline.git.revision>>
172+
- run:
173+
name: Validate "do not submit" Commits
174+
command: yarn -s admin validate-do-not-submit --base <<pipeline.git.base_revision>> --head <<pipeline.git.revision>>
175+
- run:
176+
command: yarn -s admin validate --ci
170177

171178
e2e-cli:
172179
parameters:

scripts/validate.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import validateDoNotSubmit from './validate-do-not-submit';
1515
import validateLicenses from './validate-licenses';
1616
import validateUserAnalytics from './validate-user-analytics';
1717

18-
export default async function (options: { verbose: boolean }, logger: logging.Logger) {
18+
export default async function (options: { verbose: boolean; ci: boolean }, logger: logging.Logger) {
1919
let error = false;
2020

2121
if (execSync(`git status --porcelain`).toString()) {
@@ -40,15 +40,17 @@ export default async function (options: { verbose: boolean }, logger: logging.Lo
4040
error = true;
4141
}
4242

43-
logger.info('');
44-
logger.info('Running commit validation...');
45-
error = validateCommits({}, logger.createChild('validate-commits')) != 0
46-
|| error;
43+
if (!options.ci) {
44+
logger.info('');
45+
logger.info('Running commit validation...');
46+
error = validateCommits({}, logger.createChild('validate-commits')) != 0
47+
|| error;
4748

48-
logger.info('');
49-
logger.info(`Running DO_NOT${''}_SUBMIT validation...`);
50-
error = await validateDoNotSubmit({}, logger.createChild('validate-do-not-submit')) != 0
51-
|| error;
49+
logger.info('');
50+
logger.info(`Running DO_NOT${''}_SUBMIT validation...`);
51+
error = await validateDoNotSubmit({}, logger.createChild('validate-do-not-submit')) != 0
52+
|| error;
53+
}
5254

5355
logger.info('');
5456
logger.info('Running license validation...');

0 commit comments

Comments
 (0)