1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-09-22 12:09:03 +00:00

chore(configure-workflow): prepare first version for testing in prod

This commit is contained in:
Eric Vantillard 2023-04-03 18:46:01 +02:00
parent b2d90ef23a
commit 6837e3de05
5 changed files with 44 additions and 29 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,17 +1,16 @@
{ {
"name": "typescript-action", "name": "typescript-action",
"version": "0.0.0", "version": "0.0.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "typescript-action", "name": "typescript-action",
"version": "0.0.0", "version": "0.0.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.0", "@actions/core": "^1.10.0",
"@actions/github": "^5.1.1", "@actions/github": "^5.1.1"
"@octokit/webhooks-definitions": "^3.67.3"
}, },
"devDependencies": { "devDependencies": {
"@octokit/webhooks-types": "^6.10.0", "@octokit/webhooks-types": "^6.10.0",
@ -1551,12 +1550,6 @@
"@octokit/openapi-types": "^12.11.0" "@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": { "node_modules/@octokit/webhooks-types": {
"version": "6.10.0", "version": "6.10.0",
"resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-6.10.0.tgz", "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/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": { "@octokit/webhooks-types": {
"version": "6.10.0", "version": "6.10.0",
"resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-6.10.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-6.10.0.tgz",

View File

@ -1,6 +1,6 @@
{ {
"name": "typescript-action", "name": "typescript-action",
"version": "0.0.0", "version": "0.0.1",
"private": true, "private": true,
"description": "TypeScript template action", "description": "TypeScript template action",
"main": "lib/main.js", "main": "lib/main.js",
@ -12,7 +12,8 @@
"package": "ncc build --source-map --license licenses.txt", "package": "ncc build --source-map --license licenses.txt",
"test": "jest", "test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test", "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": { "repository": {
"type": "git", "type": "git",

View File

@ -1,6 +1,6 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as github from '@actions/github'; 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"; import { wait } from "./wait";
@ -19,25 +19,51 @@ async function run(): Promise<void> {
} }
} }
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}`); console.info(`eventName: ${github.context.eventName}`);
switch (github.context.eventName) { switch (github.context.eventName) {
case "workflow_dispatch": case "workflow_dispatch":
onWorkflowDispatchEvent(github.context.payload as WorkflowDispatchEvent); onWorkflowDispatchEvent(github.context.payload as WorkflowDispatchEvent);
break; break;
case "push": 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; break;
} }
} }
function onWorkflowDispatchEvent(payload: WorkflowDispatchEvent): void { handleEvent();
core.info(`The workflow is: ${payload.workflow}`);
}
function onPush(payload: PushEvent): void {
core.info(`The head commit is: ${payload.head_commit}`);
}
hadnleEvent();
run(); run();