Skip to content

Commit cb3b3a8

Browse files
author
Simon Engledew
committed
Comment the lint cases to make maintaining easier
1 parent 92ffb08 commit cb3b3a8

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/actions-util.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ export function validateWorkflow(doc: Workflow): CodedError[] {
164164
// .jobs[key].steps[].run
165165
for (const job of Object.values(doc?.jobs || {})) {
166166
for (const step of job?.steps || []) {
167+
// this was advice that we used to give in the README
168+
// we actually want to run the analysis on the merge commit
169+
// to produce results that are more inline with expectations
170+
// (i.e: this is what will happen if you merge this PR)
171+
// and avoid some race conditions
167172
if (step?.run === "git checkout HEAD^2") {
168173
errors.push(WorkflowErrors.CheckoutWrongHead);
169174
}
@@ -202,6 +207,8 @@ export function validateWorkflow(doc: Workflow): CodedError[] {
202207
} else {
203208
const paths = doc.on.push?.paths;
204209
if (Array.isArray(paths) && paths.length > 0) {
210+
// you can end up with commits that have no baseline if they didn't change any files
211+
// at the moment we cannot go back through the history and find the most recent baseline
205212
errors.push(WorkflowErrors.PathsSpecified);
206213
}
207214
}
@@ -215,9 +222,12 @@ export function validateWorkflow(doc: Workflow): CodedError[] {
215222
(value) => !push.includes(value)
216223
);
217224
if (intersects.length > 0) {
225+
// there are branches in pull_request that may not have a baseline
218226
errors.push(WorkflowErrors.MismatchedBranches);
219227
}
220228
} else if (push.length > 0) {
229+
// push is set up to run on a subset of branches
230+
// and you could open a PR against a branch with no baseline
221231
errors.push(WorkflowErrors.MismatchedBranches);
222232
}
223233
}

0 commit comments

Comments
 (0)