mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-11 08:10:56 +00:00
chore(configure-workflow): prepare first version for testing in prod
This commit is contained in:
parent
b2d90ef23a
commit
6837e3de05
BIN
.github/actions/configure-workflow/dist/index.js
generated
vendored
BIN
.github/actions/configure-workflow/dist/index.js
generated
vendored
Binary file not shown.
BIN
.github/actions/configure-workflow/dist/index.js.map
generated
vendored
BIN
.github/actions/configure-workflow/dist/index.js.map
generated
vendored
Binary file not shown.
18
.github/actions/configure-workflow/package-lock.json
generated
vendored
18
.github/actions/configure-workflow/package-lock.json
generated
vendored
@ -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",
|
||||
|
@ -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",
|
||||
|
50
.github/actions/configure-workflow/src/main.ts
vendored
50
.github/actions/configure-workflow/src/main.ts
vendored
@ -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<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}`);
|
||||
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();
|
Loading…
Reference in New Issue
Block a user