diff --git a/.github/actions/configure-workflow/dist/index.js b/.github/actions/configure-workflow/dist/index.js index 0dd644c56..0880823e8 100644 Binary files a/.github/actions/configure-workflow/dist/index.js and b/.github/actions/configure-workflow/dist/index.js differ diff --git a/.github/actions/configure-workflow/dist/index.js.map b/.github/actions/configure-workflow/dist/index.js.map index ad4dd681c..57c2b6601 100644 Binary files a/.github/actions/configure-workflow/dist/index.js.map and b/.github/actions/configure-workflow/dist/index.js.map differ diff --git a/.github/actions/configure-workflow/package-lock.json b/.github/actions/configure-workflow/package-lock.json index 0377f0e52..1b8f7fa4c 100644 --- a/.github/actions/configure-workflow/package-lock.json +++ b/.github/actions/configure-workflow/package-lock.json @@ -1,17 +1,16 @@ { "name": "typescript-action", - "version": "0.0.0", + "version": "0.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "typescript-action", - "version": "0.0.0", + "version": "0.0.1", "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", - "@actions/github": "^5.1.1", - "@octokit/webhooks-definitions": "^3.67.3" + "@actions/github": "^5.1.1" }, "devDependencies": { "@octokit/webhooks-types": "^6.10.0", @@ -1551,12 +1550,6 @@ "@octokit/openapi-types": "^12.11.0" } }, - "node_modules/@octokit/webhooks-definitions": { - "version": "3.67.3", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-definitions/-/webhooks-definitions-3.67.3.tgz", - "integrity": "sha512-do4Z1r2OVhuI0ihJhQ8Hg+yPWnBYEBNuFNCrvtPKoYT1w81jD7pBXgGe86lYuuNirkDHb0Nxt+zt4O5GiFJfgA==", - "deprecated": "Use @octokit/webhooks-types, @octokit/webhooks-schemas, or @octokit/webhooks-examples instead. See https://github.com/octokit/webhooks/issues/447" - }, "node_modules/@octokit/webhooks-types": { "version": "6.10.0", "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-6.10.0.tgz", @@ -9593,11 +9586,6 @@ "@octokit/openapi-types": "^12.11.0" } }, - "@octokit/webhooks-definitions": { - "version": "3.67.3", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-definitions/-/webhooks-definitions-3.67.3.tgz", - "integrity": "sha512-do4Z1r2OVhuI0ihJhQ8Hg+yPWnBYEBNuFNCrvtPKoYT1w81jD7pBXgGe86lYuuNirkDHb0Nxt+zt4O5GiFJfgA==" - }, "@octokit/webhooks-types": { "version": "6.10.0", "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-6.10.0.tgz", diff --git a/.github/actions/configure-workflow/package.json b/.github/actions/configure-workflow/package.json index bccca04f3..d09776036 100644 --- a/.github/actions/configure-workflow/package.json +++ b/.github/actions/configure-workflow/package.json @@ -1,6 +1,6 @@ { "name": "typescript-action", - "version": "0.0.0", + "version": "0.0.1", "private": true, "description": "TypeScript template action", "main": "lib/main.js", @@ -12,7 +12,8 @@ "package": "ncc build --source-map --license licenses.txt", "test": "jest", "all": "npm run build && npm run format && npm run lint && npm run package && npm test", - "test-job": "npm run build && npm run package && pushd ../../../ && act --job testing-workflow-config && popd" + "test-job": "npm run build && npm run package && pushd ../../../ && act --job testing-workflow-config && popd", + "clean": "rm -rf node_modules lib .idea" }, "repository": { "type": "git", diff --git a/.github/actions/configure-workflow/src/main.ts b/.github/actions/configure-workflow/src/main.ts index a90b9ab59..76d3fa92e 100644 --- a/.github/actions/configure-workflow/src/main.ts +++ b/.github/actions/configure-workflow/src/main.ts @@ -1,6 +1,6 @@ import * as core from '@actions/core'; import * as github from '@actions/github'; -import { PushEvent, WorkflowDispatchEvent } from '@octokit/webhooks-types'; +import {PullRequestEvent, PushEvent, ReleaseEvent, WorkflowDispatchEvent} from '@octokit/webhooks-types'; import { wait } from "./wait"; @@ -19,25 +19,51 @@ async function run(): Promise { } } -function hadnleEvent(): void { +function onPullRequestEvent(payload: PullRequestEvent) { + switch(payload.action){ + case "labeled": + console.log("pull request label "+payload.label) + break; + default: + console.log("pull request action "+payload.action) + } + console.info('pull request event:',payload) +} + +function onWorkflowDispatchEvent(payload: WorkflowDispatchEvent): void { + console.info('workflow dispatch event:',payload) +} + +function onPushEvent(payload: PushEvent): void { + console.info('push event:',payload) +} + +function onReleaseEvent(payload: ReleaseEvent) { + console.info('onReleaseEvent:',payload) + +} + +function handleEvent(): void { console.info(`eventName: ${github.context.eventName}`); switch (github.context.eventName) { case "workflow_dispatch": onWorkflowDispatchEvent(github.context.payload as WorkflowDispatchEvent); break; case "push": - onPush(github.context.payload as PushEvent); + onPushEvent(github.context.payload as PushEvent); + break; + case "pull_request": + onPullRequestEvent(github.context.payload as PullRequestEvent) + break; + // case "pull_request_target": + // onPullRequestEvent(github.context.payload as PullRequestEvent) + // break; + case "release": + onReleaseEvent(github.context.payload as ReleaseEvent) + default: break; } } -function onWorkflowDispatchEvent(payload: WorkflowDispatchEvent): void { - core.info(`The workflow is: ${payload.workflow}`); -} - -function onPush(payload: PushEvent): void { - core.info(`The head commit is: ${payload.head_commit}`); -} - -hadnleEvent(); +handleEvent(); run(); \ No newline at end of file