@juangcarmona/lighthouse-sdlc 0.18.4 → 0.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juangcarmona/lighthouse-sdlc",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "type": "module",
5
5
  "description": "Provider-neutral SDLC skills, commands and route contracts for Lighthouse adopters",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { checkImplementationPullRequest } from './proposal-review.mjs';
3
- import { authorizedCiCallback, productOnlyCheckpoint, isStaleProductDecision, projectImplementationPrState, reconcileImplementationPr, scheduledImplementationPulls, setPullRequestDraft } from './pr-state.mjs';
3
+ import { authorizedCiCallback, isCurrentPullRequestEvent, productOnlyCheckpoint, isStaleProductDecision, projectImplementationPrState, reconcileImplementationPr, scheduledImplementationPulls, setPullRequestDraft } from './pr-state.mjs';
4
4
  import { handoff } from './handoff.mjs';
5
5
  import { productProposalProof } from './product-change.mjs';
6
6
 
@@ -64,7 +64,7 @@ async function main() {
64
64
  for (const number of candidates) {
65
65
  if (!Number.isSafeInteger(number)) continue;
66
66
  const pr = await api(`pulls/${number}`);
67
- if (env.GITHUB_EVENT_NAME === 'pull_request' && pr.head.sha !== event.pull_request.head.sha) continue;
67
+ if (env.GITHUB_EVENT_NAME === 'pull_request' && (pr.head.sha !== event.pull_request.head.sha || !isCurrentPullRequestEvent(event.action, pr))) continue;
68
68
  if (env.GITHUB_EVENT_NAME === 'workflow_run' && pr.head.sha !== event.workflow_run.head_sha) continue;
69
69
  if (ciCallback && pr.head.sha !== env.GITHUB_SHA) continue;
70
70
  if (pr.base.ref !== metadata.default_branch) continue;
package/src/pr-state.mjs CHANGED
@@ -4,6 +4,14 @@ import { validateProductCheckpoint, productProposalProof } from './product-chang
4
4
 
5
5
  const marker = /<!-- lighthouse-pr-state:(\{[^\n]*\}) -->/;
6
6
 
7
+ export function isCurrentPullRequestEvent(action, pr) {
8
+ if (action === 'converted_to_draft') return pr?.state === 'open' && pr.draft === true;
9
+ if (action === 'ready_for_review') return pr?.state === 'open' && pr.draft === false;
10
+ if (action === 'closed') return pr?.state === 'closed';
11
+ if (action === 'reopened') return pr?.state === 'open';
12
+ return false;
13
+ }
14
+
7
15
  export function productOnlyCheckpoint(pr) {
8
16
  if (pr?.body?.includes('<!-- lighthouse-product-implementation:') || productProposalProof(pr)) return null;
9
17
  const matches = [...(pr?.body ?? '').matchAll(/<!-- lighthouse-product-change(?:-checkpoint|:checkpoint):(\{[^\n]*\}) -->/g)];