pkg-pr-new 0.0.6 → 0.0.8

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/environments.ts CHANGED
@@ -25,6 +25,8 @@ declare global {
25
25
  GITHUB_EVENT_PATH: string;
26
26
  // A unique number for each workflow run within a repository. This number does not change if you re-run the workflow run. For example, 1658821493.
27
27
  GITHUB_RUN_ID: string;
28
+ // The job_id of the current job. For example, greeting_job.
29
+ GITHUB_JOB: string;
28
30
  // A unique number for each attempt of a particular workflow run in a repository. This number begins at 1 for the workflow run's first attempt, and increments with each re-run. For example, 3.
29
31
  GITHUB_RUN_ATTEMPT: string;
30
32
  }
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { defineCommand, runMain, parseArgs } from "citty";
1
+ import { defineCommand, runMain } from "citty";
2
2
  import assert from "node:assert";
3
3
  import path from "path";
4
4
  import ezSpawn from "@jsdevtools/ez-spawn";
@@ -20,7 +20,8 @@ declare global {
20
20
  var API_URL: string;
21
21
  }
22
22
 
23
- const publishUrl = new URL("/publish", API_URL);
23
+ const apiUrl = process.env.API_URL ?? API_URL
24
+ const publishUrl = new URL("/publish", apiUrl);
24
25
 
25
26
  const main = defineCommand({
26
27
  meta: {
@@ -71,10 +72,8 @@ const main = defineCommand({
71
72
  );
72
73
  process.exit(1);
73
74
  }
74
- const octokit = new Octokit();
75
75
 
76
76
  const {
77
- GITHUB_SERVER_URL,
78
77
  GITHUB_REPOSITORY,
79
78
  GITHUB_RUN_ID,
80
79
  GITHUB_RUN_ATTEMPT,
@@ -83,18 +82,17 @@ const main = defineCommand({
83
82
 
84
83
  const [owner, repo] = GITHUB_REPOSITORY.split("/");
85
84
 
86
- // Note: If you need to use a workflow run's URL from within a job, you can combine these variables: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
87
- const url = `${GITHUB_SERVER_URL}/${owner}/${repo}/actions/runs/${GITHUB_RUN_ID}`;
88
-
89
85
  const metadata = {
90
- url,
86
+ owner,
87
+ repo,
88
+ run: Number(GITHUB_RUN_ID),
91
89
  attempt: Number(GITHUB_RUN_ATTEMPT),
92
90
  actor: Number(GITHUB_ACTOR_ID),
93
91
  };
94
92
 
95
93
  const key = hash(metadata);
96
94
 
97
- const checkResponse = await fetch(new URL("/check", API_URL), {
95
+ const checkResponse = await fetch(new URL("/check", apiUrl), {
98
96
  method: "POST",
99
97
  body: JSON.stringify({
100
98
  owner,
@@ -128,7 +126,7 @@ const main = defineCommand({
128
126
  pJson.name,
129
127
  new URL(
130
128
  `/${owner}/${repo}/${pJson.name}@${sha}`,
131
- API_URL,
129
+ apiUrl,
132
130
  ).href,
133
131
  );
134
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pkg-pr-new",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
Binary file