From 83e74801ff3e1f628ca208db910e9694699b4ee5 Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Mon, 18 Dec 2023 13:48:55 +0100 Subject: [PATCH] Add owner field to the output (#449) * Adding owner info --- .github/workflows/testing.yml | 12 +- dist/main.js | 465 +++++++++++++++++++++++++++++----- src/main.ts | 14 +- 3 files changed, 412 insertions(+), 79 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 3965850..fcea115 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -68,7 +68,7 @@ jobs: # upload the second result file as an artefact - name: Upload result file as artefact if: always() - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 with: name: actions-user path: ${{ steps.load-actions.outputs.actions-file-path }} @@ -92,9 +92,9 @@ jobs: # upload the second result file as an artefact - name: Upload result file as artefact - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 with: - name: actions-user + name: actions-user-second-run path: ${{ steps.load-actions-second-run.outputs.actions-file-path }} # validate that the two files have different names @@ -151,7 +151,7 @@ jobs: fi - name: Upload result file as artefact - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 if: always() with: name: actions-organization-with-forks @@ -201,7 +201,7 @@ jobs: fi - name: Upload result file as artefact - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 with: name: actions-organization path: ${{ steps.load-actions.outputs.actions-file-path }} @@ -213,7 +213,7 @@ jobs: - test-load-from-organization - test-load-from-organization-with-forks steps: - - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + - uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 # v4.0.0 - run: | ls -la diff --git a/dist/main.js b/dist/main.js index fa871c3..5e51b6c 100644 --- a/dist/main.js +++ b/dist/main.js @@ -14108,7 +14108,7 @@ var require_lodash = __commonJS({ } return new LodashWrapper(value); } - var baseCreate = function() { + var baseCreate = /* @__PURE__ */ function() { function object() { } return function(proto) { @@ -17415,7 +17415,7 @@ var require_lodash = __commonJS({ var gte = createRelationalOperation(function(value, other) { return value >= other; }); - var isArguments = baseIsArguments(function() { + var isArguments = baseIsArguments(/* @__PURE__ */ function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); @@ -20547,14 +20547,43 @@ var require_dist_node22 = __commonJS({ // node_modules/@octokit/webhooks/dist-node/index.js var require_dist_node23 = __commonJS({ - "node_modules/@octokit/webhooks/dist-node/index.js"(exports) { + "node_modules/@octokit/webhooks/dist-node/index.js"(exports, module2) { "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - function _interopDefault(ex) { - return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex; - } - var AggregateError = _interopDefault(require_aggregate_error()); - var webhooksMethods = require_dist_node22(); + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var dist_src_exports = {}; + __export2(dist_src_exports, { + Webhooks: () => Webhooks, + createEventHandler: () => createEventHandler, + createNodeMiddleware: () => createNodeMiddleware, + emitterEventNames: () => emitterEventNames + }); + module2.exports = __toCommonJS2(dist_src_exports); var createLogger = (logger) => ({ debug: () => { }, @@ -20564,7 +20593,266 @@ var require_dist_node23 = __commonJS({ error: console.error.bind(console), ...logger }); - var emitterEventNames = ["branch_protection_rule", "branch_protection_rule.created", "branch_protection_rule.deleted", "branch_protection_rule.edited", "check_run", "check_run.completed", "check_run.created", "check_run.requested_action", "check_run.rerequested", "check_suite", "check_suite.completed", "check_suite.requested", "check_suite.rerequested", "code_scanning_alert", "code_scanning_alert.appeared_in_branch", "code_scanning_alert.closed_by_user", "code_scanning_alert.created", "code_scanning_alert.fixed", "code_scanning_alert.reopened", "code_scanning_alert.reopened_by_user", "commit_comment", "commit_comment.created", "create", "delete", "dependabot_alert", "dependabot_alert.created", "dependabot_alert.dismissed", "dependabot_alert.fixed", "dependabot_alert.reintroduced", "dependabot_alert.reopened", "deploy_key", "deploy_key.created", "deploy_key.deleted", "deployment", "deployment.created", "deployment_status", "deployment_status.created", "discussion", "discussion.answered", "discussion.category_changed", "discussion.created", "discussion.deleted", "discussion.edited", "discussion.labeled", "discussion.locked", "discussion.pinned", "discussion.transferred", "discussion.unanswered", "discussion.unlabeled", "discussion.unlocked", "discussion.unpinned", "discussion_comment", "discussion_comment.created", "discussion_comment.deleted", "discussion_comment.edited", "fork", "github_app_authorization", "github_app_authorization.revoked", "gollum", "installation", "installation.created", "installation.deleted", "installation.new_permissions_accepted", "installation.suspend", "installation.unsuspend", "installation_repositories", "installation_repositories.added", "installation_repositories.removed", "installation_target", "installation_target.renamed", "issue_comment", "issue_comment.created", "issue_comment.deleted", "issue_comment.edited", "issues", "issues.assigned", "issues.closed", "issues.deleted", "issues.demilestoned", "issues.edited", "issues.labeled", "issues.locked", "issues.milestoned", "issues.opened", "issues.pinned", "issues.reopened", "issues.transferred", "issues.unassigned", "issues.unlabeled", "issues.unlocked", "issues.unpinned", "label", "label.created", "label.deleted", "label.edited", "marketplace_purchase", "marketplace_purchase.cancelled", "marketplace_purchase.changed", "marketplace_purchase.pending_change", "marketplace_purchase.pending_change_cancelled", "marketplace_purchase.purchased", "member", "member.added", "member.edited", "member.removed", "membership", "membership.added", "membership.removed", "merge_group", "merge_group.checks_requested", "meta", "meta.deleted", "milestone", "milestone.closed", "milestone.created", "milestone.deleted", "milestone.edited", "milestone.opened", "org_block", "org_block.blocked", "org_block.unblocked", "organization", "organization.deleted", "organization.member_added", "organization.member_invited", "organization.member_removed", "organization.renamed", "package", "package.published", "package.updated", "page_build", "ping", "project", "project.closed", "project.created", "project.deleted", "project.edited", "project.reopened", "project_card", "project_card.converted", "project_card.created", "project_card.deleted", "project_card.edited", "project_card.moved", "project_column", "project_column.created", "project_column.deleted", "project_column.edited", "project_column.moved", "projects_v2_item", "projects_v2_item.archived", "projects_v2_item.converted", "projects_v2_item.created", "projects_v2_item.deleted", "projects_v2_item.edited", "projects_v2_item.reordered", "projects_v2_item.restored", "public", "pull_request", "pull_request.assigned", "pull_request.auto_merge_disabled", "pull_request.auto_merge_enabled", "pull_request.closed", "pull_request.converted_to_draft", "pull_request.dequeued", "pull_request.edited", "pull_request.labeled", "pull_request.locked", "pull_request.opened", "pull_request.queued", "pull_request.ready_for_review", "pull_request.reopened", "pull_request.review_request_removed", "pull_request.review_requested", "pull_request.synchronize", "pull_request.unassigned", "pull_request.unlabeled", "pull_request.unlocked", "pull_request_review", "pull_request_review.dismissed", "pull_request_review.edited", "pull_request_review.submitted", "pull_request_review_comment", "pull_request_review_comment.created", "pull_request_review_comment.deleted", "pull_request_review_comment.edited", "pull_request_review_thread", "pull_request_review_thread.resolved", "pull_request_review_thread.unresolved", "push", "registry_package", "registry_package.published", "registry_package.updated", "release", "release.created", "release.deleted", "release.edited", "release.prereleased", "release.published", "release.released", "release.unpublished", "repository", "repository.archived", "repository.created", "repository.deleted", "repository.edited", "repository.privatized", "repository.publicized", "repository.renamed", "repository.transferred", "repository.unarchived", "repository_dispatch", "repository_import", "repository_vulnerability_alert", "repository_vulnerability_alert.create", "repository_vulnerability_alert.dismiss", "repository_vulnerability_alert.reopen", "repository_vulnerability_alert.resolve", "secret_scanning_alert", "secret_scanning_alert.created", "secret_scanning_alert.reopened", "secret_scanning_alert.resolved", "security_advisory", "security_advisory.performed", "security_advisory.published", "security_advisory.updated", "security_advisory.withdrawn", "sponsorship", "sponsorship.cancelled", "sponsorship.created", "sponsorship.edited", "sponsorship.pending_cancellation", "sponsorship.pending_tier_change", "sponsorship.tier_changed", "star", "star.created", "star.deleted", "status", "team", "team.added_to_repository", "team.created", "team.deleted", "team.edited", "team.removed_from_repository", "team_add", "watch", "watch.started", "workflow_dispatch", "workflow_job", "workflow_job.completed", "workflow_job.in_progress", "workflow_job.queued", "workflow_run", "workflow_run.completed", "workflow_run.in_progress", "workflow_run.requested"]; + var emitterEventNames = [ + "branch_protection_rule", + "branch_protection_rule.created", + "branch_protection_rule.deleted", + "branch_protection_rule.edited", + "check_run", + "check_run.completed", + "check_run.created", + "check_run.requested_action", + "check_run.rerequested", + "check_suite", + "check_suite.completed", + "check_suite.requested", + "check_suite.rerequested", + "code_scanning_alert", + "code_scanning_alert.appeared_in_branch", + "code_scanning_alert.closed_by_user", + "code_scanning_alert.created", + "code_scanning_alert.fixed", + "code_scanning_alert.reopened", + "code_scanning_alert.reopened_by_user", + "commit_comment", + "commit_comment.created", + "create", + "delete", + "dependabot_alert", + "dependabot_alert.created", + "dependabot_alert.dismissed", + "dependabot_alert.fixed", + "dependabot_alert.reintroduced", + "dependabot_alert.reopened", + "deploy_key", + "deploy_key.created", + "deploy_key.deleted", + "deployment", + "deployment.created", + "deployment_status", + "deployment_status.created", + "discussion", + "discussion.answered", + "discussion.category_changed", + "discussion.created", + "discussion.deleted", + "discussion.edited", + "discussion.labeled", + "discussion.locked", + "discussion.pinned", + "discussion.transferred", + "discussion.unanswered", + "discussion.unlabeled", + "discussion.unlocked", + "discussion.unpinned", + "discussion_comment", + "discussion_comment.created", + "discussion_comment.deleted", + "discussion_comment.edited", + "fork", + "github_app_authorization", + "github_app_authorization.revoked", + "gollum", + "installation", + "installation.created", + "installation.deleted", + "installation.new_permissions_accepted", + "installation.suspend", + "installation.unsuspend", + "installation_repositories", + "installation_repositories.added", + "installation_repositories.removed", + "installation_target", + "installation_target.renamed", + "issue_comment", + "issue_comment.created", + "issue_comment.deleted", + "issue_comment.edited", + "issues", + "issues.assigned", + "issues.closed", + "issues.deleted", + "issues.demilestoned", + "issues.edited", + "issues.labeled", + "issues.locked", + "issues.milestoned", + "issues.opened", + "issues.pinned", + "issues.reopened", + "issues.transferred", + "issues.unassigned", + "issues.unlabeled", + "issues.unlocked", + "issues.unpinned", + "label", + "label.created", + "label.deleted", + "label.edited", + "marketplace_purchase", + "marketplace_purchase.cancelled", + "marketplace_purchase.changed", + "marketplace_purchase.pending_change", + "marketplace_purchase.pending_change_cancelled", + "marketplace_purchase.purchased", + "member", + "member.added", + "member.edited", + "member.removed", + "membership", + "membership.added", + "membership.removed", + "merge_group", + "merge_group.checks_requested", + "meta", + "meta.deleted", + "milestone", + "milestone.closed", + "milestone.created", + "milestone.deleted", + "milestone.edited", + "milestone.opened", + "org_block", + "org_block.blocked", + "org_block.unblocked", + "organization", + "organization.deleted", + "organization.member_added", + "organization.member_invited", + "organization.member_removed", + "organization.renamed", + "package", + "package.published", + "package.updated", + "page_build", + "ping", + "project", + "project.closed", + "project.created", + "project.deleted", + "project.edited", + "project.reopened", + "project_card", + "project_card.converted", + "project_card.created", + "project_card.deleted", + "project_card.edited", + "project_card.moved", + "project_column", + "project_column.created", + "project_column.deleted", + "project_column.edited", + "project_column.moved", + "projects_v2_item", + "projects_v2_item.archived", + "projects_v2_item.converted", + "projects_v2_item.created", + "projects_v2_item.deleted", + "projects_v2_item.edited", + "projects_v2_item.reordered", + "projects_v2_item.restored", + "public", + "pull_request", + "pull_request.assigned", + "pull_request.auto_merge_disabled", + "pull_request.auto_merge_enabled", + "pull_request.closed", + "pull_request.converted_to_draft", + "pull_request.demilestoned", + "pull_request.dequeued", + "pull_request.edited", + "pull_request.labeled", + "pull_request.locked", + "pull_request.milestoned", + "pull_request.opened", + "pull_request.queued", + "pull_request.ready_for_review", + "pull_request.reopened", + "pull_request.review_request_removed", + "pull_request.review_requested", + "pull_request.synchronize", + "pull_request.unassigned", + "pull_request.unlabeled", + "pull_request.unlocked", + "pull_request_review", + "pull_request_review.dismissed", + "pull_request_review.edited", + "pull_request_review.submitted", + "pull_request_review_comment", + "pull_request_review_comment.created", + "pull_request_review_comment.deleted", + "pull_request_review_comment.edited", + "pull_request_review_thread", + "pull_request_review_thread.resolved", + "pull_request_review_thread.unresolved", + "push", + "registry_package", + "registry_package.published", + "registry_package.updated", + "release", + "release.created", + "release.deleted", + "release.edited", + "release.prereleased", + "release.published", + "release.released", + "release.unpublished", + "repository", + "repository.archived", + "repository.created", + "repository.deleted", + "repository.edited", + "repository.privatized", + "repository.publicized", + "repository.renamed", + "repository.transferred", + "repository.unarchived", + "repository_dispatch", + "repository_import", + "repository_vulnerability_alert", + "repository_vulnerability_alert.create", + "repository_vulnerability_alert.dismiss", + "repository_vulnerability_alert.reopen", + "repository_vulnerability_alert.resolve", + "secret_scanning_alert", + "secret_scanning_alert.created", + "secret_scanning_alert.reopened", + "secret_scanning_alert.resolved", + "security_advisory", + "security_advisory.performed", + "security_advisory.published", + "security_advisory.updated", + "security_advisory.withdrawn", + "sponsorship", + "sponsorship.cancelled", + "sponsorship.created", + "sponsorship.edited", + "sponsorship.pending_cancellation", + "sponsorship.pending_tier_change", + "sponsorship.tier_changed", + "star", + "star.created", + "star.deleted", + "status", + "team", + "team.added_to_repository", + "team.created", + "team.deleted", + "team.edited", + "team.removed_from_repository", + "team_add", + "watch", + "watch.started", + "workflow_dispatch", + "workflow_job", + "workflow_job.completed", + "workflow_job.in_progress", + "workflow_job.queued", + "workflow_run", + "workflow_run.completed", + "workflow_run.in_progress", + "workflow_run.requested" + ]; function handleEventHandlers(state, webhookName, handler) { if (!state.hooks[webhookName]) { state.hooks[webhookName] = []; @@ -20573,7 +20861,9 @@ var require_dist_node23 = __commonJS({ } function receiverOn(state, webhookNameOrNames, handler) { if (Array.isArray(webhookNameOrNames)) { - webhookNameOrNames.forEach((webhookName) => receiverOn(state, webhookName, handler)); + webhookNameOrNames.forEach( + (webhookName) => receiverOn(state, webhookName, handler) + ); return; } if (["*", "error"].includes(webhookNameOrNames)) { @@ -20582,7 +20872,9 @@ var require_dist_node23 = __commonJS({ throw new Error(message); } if (!emitterEventNames.includes(webhookNameOrNames)) { - state.log.warn(`"${webhookNameOrNames}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`); + state.log.warn( + `"${webhookNameOrNames}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)` + ); } handleEventHandlers(state, webhookNameOrNames, handler); } @@ -20592,18 +20884,19 @@ var require_dist_node23 = __commonJS({ function receiverOnError(state, handler) { handleEventHandlers(state, "error", handler); } + var import_aggregate_error = __toESM2(require_aggregate_error()); function wrapErrorHandler(handler, error2) { let returnValue; try { returnValue = handler(error2); - } catch (error3) { + } catch (error22) { console.log('FATAL: Error occurred in "error" event handler'); - console.log(error3); + console.log(error22); } if (returnValue && returnValue.catch) { - returnValue.catch((error3) => { + returnValue.catch((error22) => { console.log('FATAL: Error occurred in "error" event handler'); - console.log(error3); + console.log(error22); }); } } @@ -20617,7 +20910,7 @@ var require_dist_node23 = __commonJS({ function receiverHandle(state, event) { const errorHandlers = state.hooks.error || []; if (event instanceof Error) { - const error2 = Object.assign(new AggregateError([event]), { + const error2 = Object.assign(new import_aggregate_error.default([event]), { event, errors: [event] }); @@ -20625,12 +20918,16 @@ var require_dist_node23 = __commonJS({ return Promise.reject(error2); } if (!event || !event.name) { - throw new AggregateError(["Event name not passed"]); + throw new import_aggregate_error.default(["Event name not passed"]); } if (!event.payload) { - throw new AggregateError(["Event payload not passed"]); + throw new import_aggregate_error.default(["Event payload not passed"]); } - const hooks = getHooks(state, "action" in event.payload ? event.payload.action : null, event.name); + const hooks = getHooks( + state, + "action" in event.payload ? event.payload.action : null, + event.name + ); if (hooks.length === 0) { return Promise.resolve(); } @@ -20642,15 +20939,13 @@ var require_dist_node23 = __commonJS({ } return promise.then((event2) => { return handler(event2); - }).catch((error2) => errors.push(Object.assign(error2, { - event - }))); + }).catch((error2) => errors.push(Object.assign(error2, { event }))); }); return Promise.all(promises).then(() => { if (errors.length === 0) { return; } - const error2 = new AggregateError(errors); + const error2 = new import_aggregate_error.default(errors); Object.assign(error2, { event, errors @@ -20661,7 +20956,9 @@ var require_dist_node23 = __commonJS({ } function removeListener(state, webhookNameOrNames, handler) { if (Array.isArray(webhookNameOrNames)) { - webhookNameOrNames.forEach((webhookName) => removeListener(state, webhookName, handler)); + webhookNameOrNames.forEach( + (webhookName) => removeListener(state, webhookName, handler) + ); return; } if (!state.hooks[webhookNameOrNames]) { @@ -20690,6 +20987,7 @@ var require_dist_node23 = __commonJS({ receive: receiverHandle.bind(null, state) }; } + var import_webhooks_methods = require_dist_node22(); function toNormalizedJsonString(payload) { const payloadString = JSON.stringify(payload); return payloadString.replace(/[^\\]\\u[\da-f]{4}/g, (s) => { @@ -20697,19 +20995,33 @@ var require_dist_node23 = __commonJS({ }); } async function sign(secret, payload) { - return webhooksMethods.sign(secret, typeof payload === "string" ? payload : toNormalizedJsonString(payload)); + return (0, import_webhooks_methods.sign)( + secret, + typeof payload === "string" ? payload : toNormalizedJsonString(payload) + ); } + var import_webhooks_methods2 = require_dist_node22(); async function verify(secret, payload, signature) { - return webhooksMethods.verify(secret, typeof payload === "string" ? payload : toNormalizedJsonString(payload), signature); + return (0, import_webhooks_methods2.verify)( + secret, + typeof payload === "string" ? payload : toNormalizedJsonString(payload), + signature + ); } + var import_webhooks_methods3 = require_dist_node22(); async function verifyAndReceive(state, event) { - const matchesSignature = await webhooksMethods.verify(state.secret, typeof event.payload === "object" ? toNormalizedJsonString(event.payload) : event.payload, event.signature); + const matchesSignature = await (0, import_webhooks_methods3.verify)( + state.secret, + typeof event.payload === "object" ? toNormalizedJsonString(event.payload) : event.payload, + event.signature + ).catch(() => false); if (!matchesSignature) { - const error2 = new Error("[@octokit/webhooks] signature does not match event payload and secret"); - return state.eventHandler.receive(Object.assign(error2, { - event, - status: 400 - })); + const error2 = new Error( + "[@octokit/webhooks] signature does not match event payload and secret" + ); + return state.eventHandler.receive( + Object.assign(error2, { event, status: 400 }) + ); } return state.eventHandler.receive({ id: event.id, @@ -20717,21 +21029,28 @@ var require_dist_node23 = __commonJS({ payload: typeof event.payload === "string" ? JSON.parse(event.payload) : event.payload }); } - var WEBHOOK_HEADERS = ["x-github-event", "x-hub-signature-256", "x-github-delivery"]; + var WEBHOOK_HEADERS = [ + "x-github-event", + "x-hub-signature-256", + "x-github-delivery" + ]; function getMissingHeaders(request) { return WEBHOOK_HEADERS.filter((header) => !(header in request.headers)); } + var import_aggregate_error2 = __toESM2(require_aggregate_error()); function getPayload(request) { if (request.body) { if (typeof request.body !== "string") { - console.warn("[@octokit/webhooks] Passing the payload as a JSON object in `request.body` is deprecated and will be removed in a future release of `@octokit/webhooks`, please pass it as a a `string` instead."); + console.warn( + "[@octokit/webhooks] Passing the payload as a JSON object in `request.body` is deprecated and will be removed in a future release of `@octokit/webhooks`, please pass it as a a `string` instead." + ); } return Promise.resolve(request.body); } return new Promise((resolve, reject) => { let data = ""; request.setEncoding("utf8"); - request.on("error", (error2) => reject(new AggregateError([error2]))); + request.on("error", (error2) => reject(new import_aggregate_error2.default([error2]))); request.on("data", (chunk) => data += chunk); request.on("end", () => { try { @@ -20740,7 +21059,7 @@ var require_dist_node23 = __commonJS({ } catch (error2) { error2.message = "Invalid JSON"; error2.status = 400; - reject(new AggregateError([error2])); + reject(new import_aggregate_error2.default([error2])); } }); }); @@ -20753,9 +21072,11 @@ var require_dist_node23 = __commonJS({ response.writeHead(422, { "content-type": "application/json" }); - response.end(JSON.stringify({ - error: `Request URL could not be parsed: ${request.url}` - })); + response.end( + JSON.stringify({ + error: `Request URL could not be parsed: ${request.url}` + }) + ); return; } const isUnknownRoute = request.method !== "POST" || pathname !== options.path; @@ -20772,9 +21093,11 @@ var require_dist_node23 = __commonJS({ "content-type": "application/json", accept: "application/json" }); - response.end(JSON.stringify({ - error: `Unsupported "Content-Type" header value. Must be "application/json"` - })); + response.end( + JSON.stringify({ + error: `Unsupported "Content-Type" header value. Must be "application/json"` + }) + ); return; } const missingHeaders = getMissingHeaders(request).join(", "); @@ -20782,9 +21105,11 @@ var require_dist_node23 = __commonJS({ response.writeHead(400, { "content-type": "application/json" }); - response.end(JSON.stringify({ - error: `Required headers missing: ${missingHeaders}` - })); + response.end( + JSON.stringify({ + error: `Required headers missing: ${missingHeaders}` + }) + ); return; } const eventName = request.headers["x-github-event"]; @@ -20817,18 +21142,22 @@ var require_dist_node23 = __commonJS({ const errorMessage = err.message ? `${err.name}: ${err.message}` : "Error: An Unspecified error occurred"; response.statusCode = typeof err.status !== "undefined" ? err.status : 500; options.log.error(error2); - response.end(JSON.stringify({ - error: errorMessage - })); + response.end( + JSON.stringify({ + error: errorMessage + }) + ); } } function onUnhandledRequestDefault(request, response) { response.writeHead(404, { "content-type": "application/json" }); - response.end(JSON.stringify({ - error: `Unknown route: ${request.method} ${request.url}` - })); + response.end( + JSON.stringify({ + error: `Unknown route: ${request.method} ${request.url}` + }) + ); } function createNodeMiddleware(webhooks, { path: path2 = "/api/github/webhooks", @@ -20836,7 +21165,9 @@ var require_dist_node23 = __commonJS({ log = createLogger() } = {}) { const deprecateOnUnhandledRequest = (request, response) => { - console.warn("[@octokit/webhooks] `onUnhandledRequest()` is deprecated and will be removed in a future release of `@octokit/webhooks`"); + console.warn( + "[@octokit/webhooks] `onUnhandledRequest()` is deprecated and will be removed in a future release of `@octokit/webhooks`" + ); return onUnhandledRequest(request, response); }; return middleware.bind(null, webhooks, { @@ -20859,7 +21190,9 @@ var require_dist_node23 = __commonJS({ this.sign = sign.bind(null, options.secret); this.verify = (eventPayload, signature) => { if (typeof eventPayload === "object") { - console.warn("[@octokit/webhooks] Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`"); + console.warn( + "[@octokit/webhooks] Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`" + ); } return verify(options.secret, eventPayload, signature); }; @@ -20870,16 +21203,14 @@ var require_dist_node23 = __commonJS({ this.receive = state.eventHandler.receive; this.verifyAndReceive = (options2) => { if (typeof options2.payload === "object") { - console.warn("[@octokit/webhooks] Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`"); + console.warn( + "[@octokit/webhooks] Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`" + ); } return verifyAndReceive(state, options2); }; } }; - exports.Webhooks = Webhooks; - exports.createEventHandler = createEventHandler; - exports.createNodeMiddleware = createNodeMiddleware; - exports.emitterEventNames = emitterEventNames; } }); @@ -25577,12 +25908,18 @@ var require_directives = __commonJS({ onError("Verbatim tags must end with a >"); return verbatim; } - const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/); + const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s); if (!suffix) onError(`The ${source} tag has no suffix`); const prefix = this.tags[handle]; - if (prefix) - return prefix + decodeURIComponent(suffix); + if (prefix) { + try { + return prefix + decodeURIComponent(suffix); + } catch (error2) { + onError(String(error2)); + return null; + } + } if (handle === "!") return source; onError(`Could not resolve tag: ${source}`); @@ -33004,7 +33341,7 @@ async function getAllActionsFromForkedRepos(client, username, organization, isEn } function cloneRepo(repo, owner) { try { - const repolink = `https://${hostname}/${owner}/${repo}.git`; + const repolink = `${hostname}/${owner}/${repo}.git`; const repoPath = "actions"; if (import_fs2.default.existsSync(repoPath)) { core3.debug("folder already exists, deleting"); @@ -33158,6 +33495,7 @@ async function getActionInfo(client, owner, repo, actionFilePath, forkedFrom, is const result = new ActionContent(); if ("name" in yaml && "download_url" in yaml) { result.name = yaml.name; + result.owner = owner; result.repo = repo; result.path = actionFilePath.includes("/") ? import_path.default.dirname(actionFilePath) : ""; result.forkedfrom = forkedFrom; @@ -33226,6 +33564,7 @@ async function getWorkflowInfo(client, owner, repo, path2, isArchived = false, v result.repo = repo; result.isArchived = isArchived; result.visibility = visibility; + result.owner = owner; if (yaml.download_url !== null) { result.downloadUrl = removeTokenSetting ? yaml.download_url.replace(/\?(.*)/, "") : yaml.download_url; } diff --git a/src/main.ts b/src/main.ts index 21aa0e2..1d44f62 100644 --- a/src/main.ts +++ b/src/main.ts @@ -122,6 +122,7 @@ export class ActionContent { export class WorkflowContent { name: string | undefined + owner: string | undefined repo: string | undefined downloadUrl: string | undefined description: string | undefined @@ -404,7 +405,7 @@ async function getAllActionsFromForkedRepos( function cloneRepo(repo: string, owner: string): string { try { - const repolink = `https://${hostname}/${owner}/${repo}.git` + const repolink = `${hostname}/${owner}/${repo}.git` // create a temp directory const repoPath = 'actions' if (fs.existsSync(repoPath)) { @@ -649,6 +650,7 @@ async function getActionInfo( const result = new ActionContent() if ('name' in yaml && 'download_url' in yaml) { result.name = yaml.name + result.owner = owner result.repo = repo result.path = actionFilePath.includes("/") ? path.dirname(actionFilePath) : "" result.forkedfrom = forkedFrom @@ -670,13 +672,6 @@ async function getActionInfo( return result } - -/* - Workflows -*/ - - - /* Search for Reusable workflows and return a array with workflow details */ @@ -767,6 +762,7 @@ async function getWorkflowInfo( result.repo = repo result.isArchived = isArchived result.visibility = visibility + result.owner = owner if (yaml.download_url !== null) { result.downloadUrl = removeTokenSetting @@ -777,6 +773,4 @@ async function getWorkflowInfo( return result } - - run()