@arjunkhera/atlas 0.4.60 → 0.4.61
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/door/lib/gate.mjs
CHANGED
|
@@ -256,10 +256,15 @@ export const gateRunTitle = (pr, sha) => `gate #${pr} at ${sha}`;
|
|
|
256
256
|
export function refusal(run, { name, pr, sha, baseRef, homes, sides = () => [], audit = false, baseChanged = () => '' }) {
|
|
257
257
|
if (!run) return 'no workflow run';
|
|
258
258
|
if (!homes.get(name)?.has(run.path)) return `from ${run.path ?? 'no file'}, not a base file that defines the check`;
|
|
259
|
-
|
|
259
|
+
// Each job of the gate file, `gate` and `gate · shape`, runs on
|
|
260
|
+
// pull_request_target, so GitHub runs the base copy, and its title names the
|
|
261
|
+
// pull request and the head. A run of that file from another event runs a
|
|
262
|
+
// head copy, so it never counts.
|
|
263
|
+
const gateFile = name === GATE_CHECK || run.path === GATE_WORKFLOW;
|
|
264
|
+
const event = gateFile ? 'pull_request_target' : 'pull_request';
|
|
260
265
|
if (run.event !== event) return `from the event ${run.event}`;
|
|
261
266
|
if (run.head_sha !== sha) return 'of another head commit';
|
|
262
|
-
if (
|
|
267
|
+
if (gateFile && run.display_title !== gateRunTitle(pr, sha)) return 'of another pull request or head';
|
|
263
268
|
const pulls = run.pull_requests ?? [];
|
|
264
269
|
if (!audit && !pulls.some((each) => Number(each.number) === Number(pr) && each.base?.ref === baseRef)) return `not of #${pr} into ${baseRef}`;
|
|
265
270
|
// GitHub lists every open pull request with this head, so a run made for a
|
|
@@ -25,8 +25,10 @@ on:
|
|
|
25
25
|
# success. The key comes from atlas/owner-signers on the base. A new comment
|
|
26
26
|
# with a signed act reruns this run (atlas-gate-signed.yml).
|
|
27
27
|
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
28
|
+
# `gate` is in required_checks (roadmap A2, item 71b09109). `shape` is not
|
|
29
|
+
# yet: its owner answer reads no signed act. `atlas gate ready` counts a job
|
|
30
|
+
# of this file only from a pull_request_target run whose title names the pull
|
|
31
|
+
# request and the head.
|
|
30
32
|
#
|
|
31
33
|
# The second job, `shape`, is the repo shape check from the base (roadmap R7,
|
|
32
34
|
# design docs/design-docs/shape-check-from-base/). It is the job that
|
package/package.json
CHANGED