diff --git a/.github/actions/js-action/action.yml b/.github/actions/js-action/action.yml new file mode 100644 index 0000000..b9cc09f --- /dev/null +++ b/.github/actions/js-action/action.yml @@ -0,0 +1,21 @@ +name: 'JS Action' +description: 'Test JS Action' +inputs: + name: + description: 'Site name' + required: true + id: + description: 'Site id' + required: true + title: + description: 'Title' + required: true + payload: + description: 'payload' + required: true + token: + description: 'token' + required: true +runs: + using: 'node20' + main: 'index.js' \ No newline at end of file diff --git a/.github/actions/js-action/index.js b/.github/actions/js-action/index.js new file mode 100644 index 0000000..8557cc1 --- /dev/null +++ b/.github/actions/js-action/index.js @@ -0,0 +1,123 @@ +import { NetlifyAPI } from "netlify"; + +import * as core from "@actions/core"; +import * as github from "@actions/github"; +import https from "node:https"; + +try { + const name = core.getInput("name"); + const site_id = core.getInput("id"); + const title = core.getInput("title"); + const netlify_payload = core.getInput("payload"); + const token = core.getInput("token"); + // const branch = github.context.payload.pull_request.head.ref; + const branch = "feature/PEWEB-175-custom-domain-for-api-gw"; + + const client = new NetlifyAPI(token); + + console.log("Calling listSiteDeploys"); + let deployments = await client.listSiteDeploys({ + site_id: site_id, + branch: branch, + }); + console.log(`Deployments # ${deployments.length}`); + deployments = deployments.filter((deployment) => deployment.title == title); + console.log(`Filtered # ${deployments.length}`); + // console.log(deployments); + + // Output: + // state: 'ready', + // Statuses: + // "new" "pending_review" "accepted" "rejected" "enqueued" "building" "uploading" "uploaded" + // "preparing" "prepared" "processing" "processed" "ready" "error" "retrying" + // deploy_ssl_url: 'https://feature-peweb-175-custom-domain-for-api-gw--sportdog.netlify.app', + // deploy_time: null (in progress) or (if done) + // error_message: null (success) or str (if error) + var deployment = deployments[0]; + var deploy_id = deployment.id; + var in_progress = deployment.deploy_time == null; + console.log( + `state: ${deployment.state} (== 'ready': ${deployment.state == "ready"})` + ); + console.log(`deploy url: ${deployment.deploy_ssl_url}`); + console.log(`deploy time: ${deployment.deploy_time}`); + console.log( + `error message: ${deployment.error_message} (== null: ${ + deployment.error_message == null + })` + ); + + in_progress = true; + while (in_progress) { + console.log("Sleeping 2 sec"); + await new Promise((resolve) => setTimeout(resolve, 2000)); + console.log("Sleeping done, updating status"); + deployment = await client.getSiteDeploy({ + site_id: site_id, + deploy_id: deploy_id, + }); + in_progress = deployment.deploy_time == null; + console.log(`Got update. In progress: ${in_progress}`); + } + + console.log( + `state: ${deployment.state} (== 'ready': ${deployment.state == "ready"})` + ); + console.log(`deploy url: ${deployment.deploy_ssl_url}`); + console.log(`deploy time: ${deployment.deploy_time}`); + console.log( + `error message: ${deployment.error_message} (== null: ${ + deployment.error_message == null + })` + ); + // Get the JSON webhook payload for the event that triggered the workflow + // const payload = JSON.stringify(github.context.payload, undefined, 2); + // console.log(`The event payload: ${payload}`); + // console.log(`Head Ref: ${github.context.payload.pull_request.head.ref}`); + + // const client = new NetlifyAPI("nfp_6oiUkxrMJ4Kh1zhoGTARfLAMzbtVnbPC3e67"); + // const sites = await client.listSites(); + // console.log(sites); + + // console.log("Trying HTTP post"); + // let xhr = new XMLHttpRequest(); + // xhr.open( + // "POST", + // "https://httpbin.org/post?trigger_branch=GITHUB_HEAD_REF&trigger_title=TITLE" + // ); + // xhr.setRequestHeader("Content-Type", "applicathion/json"); + // xhr.send( + // JSON.stringify({ + // rscEnv: "STAGE", + // cognitoUserPoolId: "COGNITO_USER_POOL_ID", + // cognitoClientId: "COGNITO_CLIENT_ID", + // }) + // ); + // xhr.onload = function () { + // let resp = xhr.response; + // console.log(`HTTP Response: ${resp.message}`); + // }; + + // const options = { + // hostname: "httpbin.org", + // port: 443, + // path: "/post", + // method: "POST", + // }; + + // const req = https.request(options, (res) => { + // console.log("statusCode:", res.statusCode); + // console.log("headers:", res.headers); + + // res.on("data", (d) => { + // process.stdout.write(d); + // }); + // }); + + // req.on("error", (e) => { + // console.error(e); + // }); + // req.end(); +} catch (error) { + core.setFailed(error.message); +} diff --git a/.github/actions/js-action/package-lock.json b/.github/actions/js-action/package-lock.json new file mode 100644 index 0000000..0fc8a88 --- /dev/null +++ b/.github/actions/js-action/package-lock.json @@ -0,0 +1,595 @@ +{ + "name": "js-action", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "js-action", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@actions/core": "^1.10.1", + "@actions/github": "^6.0.0", + "netlify": "^13.1.21" + } + }, + "node_modules/@actions/core": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", + "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", + "dependencies": { + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" + } + }, + "node_modules/@actions/github": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", + "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", + "dependencies": { + "@actions/http-client": "^2.2.0", + "@octokit/core": "^5.0.1", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + } + }, + "node_modules/@actions/http-client": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", + "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "engines": { + "node": ">=14" + } + }, + "node_modules/@netlify/open-api": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@netlify/open-api/-/open-api-2.34.0.tgz", + "integrity": "sha512-C4v7Od/vnGgZ1P4JK3Fn9uUi9HkTxeUqUtj4OLnGD+rGyaVrl4JY89xMCoVksijDtO8XylYFU59CSTnQNeNw7g==", + "engines": { + "node": ">=14" + } + }, + "node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", + "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.1.0", + "@octokit/request": "^8.3.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", + "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", + "integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", + "dependencies": { + "@octokit/request": "^8.3.0", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", + "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==" + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", + "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==" + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", + "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==" + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/request": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", + "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", + "dependencies": { + "@octokit/endpoint": "^9.0.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", + "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/types": { + "version": "13.5.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.5.0.tgz", + "integrity": "sha512-HdqWTf5Z3qwDVlzCrP8UJquMwunpDiMPt5er+QjGzL4hqr/vBVY/MauQgS1xWxCDT1oMx1EULyqxncdCY/NVSQ==", + "dependencies": { + "@octokit/openapi-types": "^22.2.0" + } + }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" + }, + "node_modules/micro-api-client": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/micro-api-client/-/micro-api-client-3.3.0.tgz", + "integrity": "sha512-y0y6CUB9RLVsy3kfgayU28746QrNMpSm9O/AYGNsBgOkJr/X/Jk0VLGoO8Ude7Bpa8adywzF+MzXNZRFRsNPhg==" + }, + "node_modules/netlify": { + "version": "13.1.21", + "resolved": "https://registry.npmjs.org/netlify/-/netlify-13.1.21.tgz", + "integrity": "sha512-PLw+IskyiY+GZNvheR0JgBXIuwebKowY/JU1QBArnXT5Tza1cFbSRr2LJVdiAJCvtbYY73CapfJeSMp36nRjjQ==", + "dependencies": { + "@netlify/open-api": "^2.34.0", + "lodash-es": "^4.17.21", + "micro-api-client": "^3.3.0", + "node-fetch": "^3.0.0", + "omit.js": "^2.0.2", + "p-wait-for": "^4.0.0", + "qs": "^6.9.6" + }, + "engines": { + "node": "^14.16.0 || >=16.0.0" + } + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/object-inspect": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/omit.js": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/omit.js/-/omit.js-2.0.2.tgz", + "integrity": "sha512-hJmu9D+bNB40YpL9jYebQl4lsTW6yEHRTroJzNLqQJYHm7c+NQnJGfZmIWh8S3q3KoaxV1aLhV6B3+0N0/kyJg==" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-timeout": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", + "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-wait-for": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-wait-for/-/p-wait-for-4.1.0.tgz", + "integrity": "sha512-i8nE5q++9h8oaQHWltS1Tnnv4IoMDOlqN7C0KFG2OdbK0iFJIt6CROZ8wfBM+K4Pxqfnq4C4lkkpXqTEpB5DZw==", + "dependencies": { + "p-timeout": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==" + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } + } +} diff --git a/.github/actions/js-action/package.json b/.github/actions/js-action/package.json new file mode 100644 index 0000000..47824d9 --- /dev/null +++ b/.github/actions/js-action/package.json @@ -0,0 +1,18 @@ +{ + "name": "js-action", + "version": "1.0.0", + "main": "index.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "@actions/core": "^1.10.1", + "@actions/github": "^6.0.0", + "netlify": "^13.1.21" + } +} diff --git a/.github/scripts/netlify_wait.js b/.github/scripts/netlify_wait.js new file mode 100644 index 0000000..1604efa --- /dev/null +++ b/.github/scripts/netlify_wait.js @@ -0,0 +1,105 @@ +import { NetlifyAPI } from "netlify"; + +// module.exports = async (core, site_id, title, token) => { +export default async function netlify_wait( + core, + github, + context, + site_name, + site_id, + title, + token +) { + try { + console.log(`core: ${core}`); + console.log(`site_name: ${site_name}`); + console.log(`site_id: ${site_id}`); + console.log(`title: ${title}`); + console.log(`token: ${token}`); + const payload = JSON.stringify(context.payload); + console.log(`payload: ${payload}`); + const br = context.payload.pull_request.head.ref; + console.log(`head ref: ${br}`); + const branch = "feature/PEWEB-175-custom-domain-for-api-gw"; + + const client = new NetlifyAPI(token); + + console.log("Calling listSiteDeploys"); + let deployments = await client.listSiteDeploys({ + site_id: site_id, + branch: branch, + }); + console.log(`Deployments # ${deployments.length}`); + console.log(deployments); + deployments = deployments.filter((deployment) => deployment.title == title); + console.log(`Filtered # ${deployments.length}`); + + var deployment = deployments[0]; + var deploy_id = deployment.id; + + function deploy_in_progress(deployment) { + /** + * Netlify Deploy state is enum. Possible values are: + * "new" "pending_review" "accepted" "rejected" "enqueued" "building" "uploading" "uploaded" "preparing" "prepared" "processing" "processed" "ready" "error" "retrying" + * + * There is no specific field in the deploy data set that let us know is the process done or still in progress. + * + * By analyzing existing deploys states here we use the following logic: + * - When deploy is done Netlify sets the `deploy_time` field to a non-`null` value. + * - If error occurred Netlify sets the `error_message` to a non-`null` string. + * - Special case of a canceled deploy because of no changes could be determined by the specific error message: + * "Failed during stage 'checking build content for changes': Canceled build due to no content change" + * + * Relevant examples: + * - state: 'error', error_message: "Failed during stage 'building site': Command did not finish within the time limit", deploy_time: null, + * - state: 'error', error_message: "Failed during stage 'checking build content for changes': Canceled build due to no content change", deploy_time: null, + * - state: 'error', error_message: 'Canceled build', deploy_time: null, + * - state: 'error', error_message: 'Skipped', deploy_time: null, + * - state: 'new', error_message: null, deploy_time: null, + * - state: 'prepared', error_message: 'Canceled build', deploy_time: null, + * - state: 'ready', error_message: null, deploy_time: 333, + */ + return deployment.deploy_time == null && deployment.error_message == null; + } + + var in_progress = deploy_in_progress(deployment); + console.log( + `state: ${deployment.state} (== 'ready': ${deployment.state == "ready"})` + ); + console.log(`deploy url: ${deployment.deploy_ssl_url}`); + console.log(`deploy time: ${deployment.deploy_time}`); + console.log( + `error message: ${deployment.error_message} (== null: ${ + deployment.error_message == null + })` + ); + + in_progress = true; + while (in_progress) { + console.log("Sleeping 2 sec"); + await new Promise((resolve) => setTimeout(resolve, 10000)); + console.log("Sleeping done, updating status"); + deployment = await client.getSiteDeploy({ + site_id: site_id, + deploy_id: deploy_id, + }); + in_progress = deploy_in_progress(deployment); + console.log(`Got update. In progress: ${in_progress}`); + console.log(deployment); + } + + console.log( + `state: ${deployment.state} (== 'ready': ${deployment.state == "ready"})` + ); + console.log(`deploy url: ${deployment.deploy_ssl_url}`); + console.log(`deploy time: ${deployment.deploy_time}`); + console.log( + `error message: ${deployment.error_message} (== null: ${ + deployment.error_message == null + })` + ); + core.setOutput("site-url", deployment.deploy_ssl_url); + } catch (error) { + core.setFailed(error.message); + } +} diff --git a/.github/scripts/package.json b/.github/scripts/package.json new file mode 100644 index 0000000..db112be --- /dev/null +++ b/.github/scripts/package.json @@ -0,0 +1,16 @@ +{ + "name": "js-action", + "version": "1.0.0", + "main": "netlify_wait.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "netlify": "^13.1.21" + } +} diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml deleted file mode 100644 index 6e50626..0000000 --- a/.github/workflows/comment.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Issue Comment Test -on: - issue_comment: - types: - - created - - deleted - - edited -jobs: - up: - runs-on: ubuntu-latest - steps: - - run: echo "WORKS!" - - name: GH context - env: - GH: ${{ toJson(github)}} - run: | - echo -e "Github context:\n$GH" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..d95f80b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,182 @@ +name: Deploy +run-name: Deploy conditions test +on: + pull_request: + types: + - opened + - reopened + - synchronize + - labeled + - edited +env: + SOME_VAR: some value + SITE_ID: 28291f48-2de2-4c95-a222-07e0a5feaa22 + TITLE: gha-fullstack-deploy +jobs: + deploy-job: + runs-on: ubuntu-latest + if: | + github.event.pull_request.state == 'open' && ( + contains(github.event.pull_request.labels.*.name, 'deploy') || + endsWith(github.event.pull_request.title, '[deploy]') + ) && ( + contains(fromJSON('["opened", "reopened", "synchronize"]'), github.event.action) || + github.event.action == 'labeled' && github.event.label.name == 'deploy' || + github.event.action == 'edited' && endsWith(github.event.pull_request.title, '[deploy]') + ) + steps: + - run: echo "Start" + - name: GH context + env: + GH: ${{ toJson(github)}} ${{ github.event.pull_request.state }} + run: | + echo -e "Github context:\n$GH" + # - name: Fail step + # id: fail-step + # run: | + # asdfasdfasdf + - uses: actions/github-script@v7 + name: Cleanup comments + if: always() + with: + script: | + console.log(JSON.stringify(context)); + const { data: comments } = await github.rest.issues.listComments({ + issue_number: context.issue.number, + owner: context.repo.owner, + per_page: 100, + repo: context.repo.repo, + }); + const bot_comments = comments.filter( + ({ body, user: { login } }) => + login == "github-actions[bot]" && /^Deployment result/.test(body) + ); + bot_comments.forEach( + async ({ id }) => + await github.rest.issues.deleteComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: id, + }) + ); + - uses: actions/github-script@v7 + name: comment after failure + if: always() + with: + script: | + const status = "${{ job.status }}"; + let body = `Deployment of [the recent commit](${context.payload.pull_request.head.sha}) result: ${status}`; + if (status == "success") { + body += "\nSome variable: ${{ github.event.pull_request.url }}--${{ env.SOME_VAR }}\nAlso here is empty var value: ${{ env.EMPTY_VAR }}" + } + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: body + }) + js-script: + name: Test JS script step + runs-on: ubuntu-latest + needs: deploy-job + outputs: + devlogin-url: ${{ steps.deploy-action.outputs.devlogin-url }} + petsafe-url: ${{ steps.deploy-action.outputs.petsafe-url }} + sportdog-url: ${{ steps.deploy-action.outputs.sportdog-url }} + kurgo-url: ${{ steps.deploy-action.outputs.kurgo-url }} + invisiblefence-url: ${{ steps.deploy-action.outputs.invisiblefence-url }} + strategy: + matrix: + include: + - name: devlogin + id: 8539d742-1926-418a-81de-eb7db9c15793 + - name: petsafe + id: 8cd5e483-40c1-43d6-8459-fd5531b94aa8 + - name: sportdog + id: 28291f48-2de2-4c95-a222-07e0a5feaa22 + - name: kurgo + id: 5c214f8e-4401-49b1-a561-d0f5bbc503d5 + - name: invisiblefence + id: 423b273d-fe1d-4dd8-bba9-5f4d6d79c529 + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: "20.x" + - run: | + yarn add -W ./.github/scripts/ + - uses: actions/github-script@v7 + name: check netlify status + id: site-url + with: + script: | + console.log("Importing custom script"); + const { default: netlify_wait } = await import('${{ github.workspace }}/.github/scripts/netlify_wait.js'); + console.log("Imported custom script. Calling..."); + await netlify_wait(core, github, context, "${{ matrix.name }}", "${{ matrix.id }}", "${{ env.TITLE }}", "${{ secrets.N_TOKEN }}"); + console.log("Done"); + - id: deploy-action + run: echo "${{ matrix.name }}-url=${{ steps.site-url.outputs.site-url }}" >> "$GITHUB_OUTPUT" + + test-output: + runs-on: ubuntu-latest + needs: js-script + steps: + - run: | + echo "OUT: devlogin: ${{ needs.js-script.outputs.devlogin-url }}" + echo "OUT: petsafe: ${{ needs.js-script.outputs.petsafe-url }}" + echo "OUT: sportdog: ${{ needs.js-script.outputs.sportdog-url }}" + echo "OUT: kurgo: ${{ needs.js-script.outputs.kurgo-url }}" + echo "OUT: invisiblefence: ${{ needs.js-script.outputs.invisiblefence-url }}" + + js-job: + name: Test JS Job + runs-on: ubuntu-latest + needs: deploy-job + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Test JS Job + id: js-job + uses: ./.github/actions/js-action + with: + name: tester + id: ${{ env.SITE_ID }} + payload: '{ "key": "value", "key2": "value2" }' + token: ${{ secrets.N_TOKEN }} + title: ${{ env.TITLE }} + + report-job: + needs: deploy-job + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v3 + with: + node-version: "20.x" + - run: npm install netlify + - uses: actions/github-script@v7 + name: set check + with: + script: | + var run = true; + var count = 60; + async function countdown() { + console.log(`Countdown tick: ${count}`); + await new Promise((f) => setTimeout(f, 1000)); + count--; + if (count <= 0) { + run = false; + } + console.log(`Countdown done: ${count}`); + } + async function test() { + console.log("Start countdown"); + while (run) { + await countdown(); + } + console.log("Stop countdown"); + } + console.log("START"); + await test(); + console.log("DONE"); diff --git a/.github/workflows/destroy.yml b/.github/workflows/destroy.yml new file mode 100644 index 0000000..7e8eecd --- /dev/null +++ b/.github/workflows/destroy.yml @@ -0,0 +1,46 @@ +name: Destroy +run-name: Destroy conditions test +on: + pull_request: + types: + - closed + - edited + - unlabeled +jobs: + destroy-job: + runs-on: ubuntu-latest + if: | + github.event.action == 'closed' && ( + contains(github.event.pull_request.labels.*.name, 'deploy') || + endsWith(github.event.pull_request.title, '[deploy]') + ) || + + github.event.action == 'unlabeled' && + github.event.label.name == 'deploy' && + ! endsWith(github.event.pull_request.title, '[deploy]') || + + github.event.action == 'edited' && + ! endsWith(github.event.pull_request.title, '[deploy]') && + ! contains(github.event.pull_request.labels.*.name, 'deploy') + steps: + - run: echo "Start" + - name: GH context + env: + GH: ${{ toJson(github)}} + run: | + echo -e "Github context:\n$GH" + report-comment: + runs-on: ubuntu-latest + needs: + - destroy-job + if: needs.destroy-job.result != 'skipped' + steps: + - uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '👋 CI result: ${{ needs.destroy-job.result }}.' + }) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml deleted file mode 100644 index 3fe5559..0000000 --- a/.github/workflows/github-actions-demo.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: GitHub Actions Demo -run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 -on: - pull_request: - types: - - opened - - reopened - - synchronize - - labeled - - unlabeled - - edited - issue_comment: - types: - - created -env: - labelDeploy: ${{ github.event.label.name == 'deploy' }} - titleDeploy: ${{ endsWith(github.event.pull_request.title, '[deploy]') }} -jobs: - Explore-GitHub-Actions: - if: | - true || - github.event.label.name == 'deploy' || - endsWith(github.event.pull_request.title, '[deploy]') - runs-on: ubuntu-latest - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - name: Check out repository code - uses: actions/checkout@v4 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ github.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." - - name: Export env variable - run: export VAR=VALUE - - name: Test env variable - run: | - echo "VAR: ${VAR}" - - name: Env config - run: | - echo "VARVAR=value" >> $GITHUB_ENV - - name: Test bash env - run: | - echo $VARVAR - - name: Test wf env - run: | - echo ${{ env.VARVAR }} - - name: Print env - run: | - env | sort - - name: GH env - run: | - env | grep GITHUB | sort - - name: GH context - env: - GH: ${{ toJson(github)}} - run: | - echo -e "Github context:\n$GH" - report: - runs-on: ubuntu-latest - needs: - - Explore-GitHub-Actions - if: needs.Explore-GitHub-Actions.result != 'skipped' - steps: - - uses: actions/github-script@v7 - with: - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '👋 CI result: ${{ needs.Explore-GitHub-Actions.result }}.\nlabelDeploy: ${{ env.labelDeploy }}\ntitleDeploy: ${{ env.titleDeploy }}' - }) - - # good_job: - # runs-on: ubuntu-latest - # steps: - # - name: Just print env - # run: | - # env - - # bad_job: - # runs-on: ubuntu-latest - # steps: - # - name: Fail this step - # run: | - # no-such-command - - # report: - # runs-on: ubuntu-latest - # if: always() - # needs: - # - bad_job - # - good_job - # steps: - # - uses: actions/github-script@v6 - # with: - # script: | - # github.rest.issues.createComment({ - # issue_number: context.issue.number, - # owner: context.repo.owner, - # repo: context.repo.repo, - # body: '👋 Thanks for reporting!\nGood Job: ${{ needs.good_job.result }}\nBad job: ${{ needs.bad_job.result }}' - # }) diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..482e6a6 Binary files /dev/null and b/icon.png differ