@canyonjs/cli 1.0.30 → 1.0.31

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import node_fs from "node:fs";
4
4
  import node_path from "node:path";
5
5
  import axios from "axios";
6
6
  var package_namespaceObject = {
7
- rE: "1.0.30"
7
+ rE: "1.0.31"
8
8
  };
9
9
  function mergeNumberMaps(a = {}, b = {}) {
10
10
  const result = {
@@ -61,11 +61,14 @@ function mergeCoverageMaps(target = {}, source = {}) {
61
61
  }
62
62
  async function mapCommand(params, options) {
63
63
  console.log('Current working directory:', process.cwd());
64
- if (process.env.GITHUB_EVENT_PATH) {
65
- const event = JSON.parse(node_fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));
66
- const pr = event.pull_request;
67
- console.log(pr.number, pr.id);
68
- } else console.log('not found GITHUB_EVENT_PATH');
64
+ const isGitHubActions = 'true' === process.env.GITHUB_ACTIONS || !!process.env.GITHUB_EVENT_PATH;
65
+ let githubEvent;
66
+ if (isGitHubActions && process.env.GITHUB_EVENT_PATH) try {
67
+ if (node_fs.existsSync(process.env.GITHUB_EVENT_PATH)) githubEvent = node_fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8');
68
+ else console.log('GITHUB_EVENT_PATH file not found:', process.env.GITHUB_EVENT_PATH);
69
+ } catch (error) {
70
+ console.warn('Failed to read GITHUB_EVENT_PATH:', error);
71
+ }
69
72
  const { dsn, repo_id: repoID, sha, provider, build_target, debug, instrument_cwd, filter, scene } = params;
70
73
  if (!node_fs.existsSync(node_path.resolve(process.cwd(), '.canyon_output'))) return void console.log('No .canyon_output directory found, skipping upload.');
71
74
  const files = node_fs.readdirSync(node_path.resolve(process.cwd(), '.canyon_output'));
@@ -110,7 +113,8 @@ async function mapCommand(params, options) {
110
113
  buildTarget: build_target || '',
111
114
  coverage: Object.keys(data),
112
115
  build: {
113
- buildProvider: env_buildProvider,
116
+ provider: isGitHubActions ? "github_actions" : env_buildProvider,
117
+ event: isGitHubActions ? githubEvent : void 0,
114
118
  buildID: env_buildID,
115
119
  branch: env_branch
116
120
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canyonjs/cli",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {