diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5c06583 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,61 @@ +name: test +on: [push] +jobs: + test: + runs-on: ubuntu-latest + name: Notification test + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - name: Text only + uses: ./ + with: + token: ${{ secrets.TOKEN }} + text: ${{ github.run_id }} (1/8) Alert message + + - name: Full fields + uses: ./ + with: + token: ${{ secrets.TOKEN }} + title: Alert title + text: ${{ github.run_id }} (2/8) Alert message + priority: highest + level: success + + - name: Verbose + uses: ./ + with: + token: ${{ secrets.TOKEN }} + verbose: ${{ github.run_id }} (3/8) Verbose message + + - name: Info + uses: ./ + with: + token: ${{ secrets.TOKEN }} + info: ${{ github.run_id }} (4/8) Info message + + - name: Notice + uses: ./ + with: + token: ${{ secrets.TOKEN }} + notice: ${{ github.run_id }} (5/8) Notice message + + - name: Success + uses: ./ + with: + token: ${{ secrets.TOKEN }} + success: ${{ github.run_id }} (6/8) Success message + + - name: Warning + uses: ./ + with: + token: ${{ secrets.TOKEN }} + warning: ${{ github.run_id }} (7/8) Warning message + + - name: Error + uses: ./ + with: + token: ${{ secrets.TOKEN }} + error: ${{ github.run_id }} (8/8) Error message diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5bd8eff --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +/node_modules/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..bdc281a --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# Notify.Events for GitHub Action + +[GitHub Action](https://github.com/features/actions) for sending a notification message for [30+ messengers and other services](https://notify.events#sRecipients). + +[![Actions Status](https://github.com/notify-events/github-action/workflows/test/badge.svg)](https://github.com/notify-events/github-action/actions) +[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/notify-events/github-action/blob/master/LICENSEs) + +## Usage + +Send custom message + +```yaml +name: notify.events message +on: [push] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: send custom message + uses: notify-events/github-action@main + with: + token: ${{ secrets.NE_CHANNEL_TOKEN }} + text: This is message +``` + +## Input variables + +* token - (**required**) Notify.Events channel token +* title - Message title +* text - (**required**) Message text (allow simple html tags: \, \, \
, \) +* priority - Message priority (highest, high, normal, low, lowest) +* level - Message level (verbose, info, notice, warning, error, success) + +```yaml +uses: notify-events/github-action@main +with: + token: ${{ secrets.NE_CHANNEL_TOKEN }} + title: Build success + text: Build ${{ github.ref }} successfully + priority: info + level: success +``` + +### Predefined simple message: + +* verbose - Message text with 'verbose' level and 'lowest' priority +* info - Message text with 'info' level and 'low' priority +* notice - Message text with 'notice' level and 'low' priority +* success - Message text with 'success' level and 'normal' priority +* warning - Message text with 'warning' level and 'high' priority +* error - Message text with 'error' level and 'highest' priority + +```yaml +uses: notify-events/github-action@main +with: + token: $(( secrets.NE_CHANNEL_TOKEN }} + success: Build {{ github.ref }} successfully +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..53c982a --- /dev/null +++ b/action.yml @@ -0,0 +1,68 @@ +name: Notify.Events +author: Notify.Events +description: Sending message to 30+ messangers + +inputs: + + token: + description: | + Notify.Events channel token + required: true + + title: + description: | + Message title + required: false + + text: + description: | + Message Text (allowed simple html tags: , ,
,
) + required: false + + priority: + description: | + Message priority (highest, high, normal, low, lowest) + required: false + + level: + description: | + Message Level (verbose, info, notice, warning, error, success) + required: false + + verbose: + description: | + Message text with 'verbose' level and 'lowest' priority + required: false + + info: + description: | + Message text with 'info' level and 'low' priority + required: false + + notice: + description: | + Message text with 'notice' level and 'low' priority + required: false + + success: + description: | + Message text with 'success' level and 'normal' priority + required: false + + warning: + description: | + Message text with 'warning' level and 'high' priority + required: false + + error: + description: | + Message text with 'error' level and 'highest' priority + required: false + +runs: + using: node12 + main: dist/index.js + +branding: + icon: message-circle + color: red diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..0431c9d --- /dev/null +++ b/dist/index.js @@ -0,0 +1,7 @@ +(()=>{var __webpack_modules__={403:function(e,r,t){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,r,t,s){if(s===undefined)s=t;Object.defineProperty(e,s,{enumerable:true,get:function(){return r[t]}})}:function(e,r,t,s){if(s===undefined)s=t;e[s]=r[t]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(t!=="default"&&Object.hasOwnProperty.call(e,t))s(r,e,t);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.issue=r.issueCommand=void 0;const i=n(t(87));const a=t(163);function issueCommand(e,r,t){const s=new Command(e,r,t);process.stdout.write(s.toString()+i.EOL)}r.issueCommand=issueCommand;function issue(e,r=""){issueCommand(e,{},r)}r.issue=issue;const c="::";class Command{constructor(e,r,t){if(!e){e="missing.command"}this.command=e;this.properties=r;this.message=t}toString(){let e=c+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let r=true;for(const t in this.properties){if(this.properties.hasOwnProperty(t)){const s=this.properties[t];if(s){if(r){r=false}else{e+=","}e+=`${t}=${escapeProperty(s)}`}}}}e+=`${c}${escapeData(this.message)}`;return e}}function escapeData(e){return a.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return a.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},21:function(e,r,t){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,r,t,s){if(s===undefined)s=t;Object.defineProperty(e,s,{enumerable:true,get:function(){return r[t]}})}:function(e,r,t,s){if(s===undefined)s=t;e[s]=r[t]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(t!=="default"&&Object.hasOwnProperty.call(e,t))s(r,e,t);o(r,e);return r};var i=this&&this.__awaiter||function(e,r,t,s){function adopt(e){return e instanceof t?e:new t((function(r){r(e)}))}return new(t||(t=Promise))((function(t,o){function fulfilled(e){try{step(s.next(e))}catch(e){o(e)}}function rejected(e){try{step(s["throw"](e))}catch(e){o(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((s=s.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.getState=r.saveState=r.group=r.endGroup=r.startGroup=r.info=r.warning=r.error=r.debug=r.isDebug=r.setFailed=r.setCommandEcho=r.setOutput=r.getBooleanInput=r.getMultilineInput=r.getInput=r.addPath=r.setSecret=r.exportVariable=r.ExitCode=void 0;const a=t(403);const c=t(704);const u=t(163);const p=n(t(87));const l=n(t(622));var d;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(d=r.ExitCode||(r.ExitCode={}));function exportVariable(e,r){const t=u.toCommandValue(r);process.env[e]=t;const s=process.env["GITHUB_ENV"]||"";if(s){const r="_GitHubActionsFileCommandDelimeter_";const s=`${e}<<${r}${p.EOL}${t}${p.EOL}${r}`;c.issueCommand("ENV",s)}else{a.issueCommand("set-env",{name:e},t)}}r.exportVariable=exportVariable;function setSecret(e){a.issueCommand("add-mask",{},e)}r.setSecret=setSecret;function addPath(e){const r=process.env["GITHUB_PATH"]||"";if(r){c.issueCommand("PATH",e)}else{a.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${l.delimiter}${process.env["PATH"]}`}r.addPath=addPath;function getInput(e,r){const t=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(r&&r.required&&!t){throw new Error(`Input required and not supplied: ${e}`)}if(r&&r.trimWhitespace===false){return t}return t.trim()}r.getInput=getInput;function getMultilineInput(e,r){const t=getInput(e,r).split("\n").filter((e=>e!==""));return t}r.getMultilineInput=getMultilineInput;function getBooleanInput(e,r){const t=["true","True","TRUE"];const s=["false","False","FALSE"];const o=getInput(e,r);if(t.includes(o))return true;if(s.includes(o))return false;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${e}\n`+`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}r.getBooleanInput=getBooleanInput;function setOutput(e,r){process.stdout.write(p.EOL);a.issueCommand("set-output",{name:e},r)}r.setOutput=setOutput;function setCommandEcho(e){a.issue("echo",e?"on":"off")}r.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=d.Failure;error(e)}r.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}r.isDebug=isDebug;function debug(e){a.issueCommand("debug",{},e)}r.debug=debug;function error(e){a.issue("error",e instanceof Error?e.toString():e)}r.error=error;function warning(e){a.issue("warning",e instanceof Error?e.toString():e)}r.warning=warning;function info(e){process.stdout.write(e+p.EOL)}r.info=info;function startGroup(e){a.issue("group",e)}r.startGroup=startGroup;function endGroup(){a.issue("endgroup")}r.endGroup=endGroup;function group(e,r){return i(this,void 0,void 0,(function*(){startGroup(e);let t;try{t=yield r()}finally{endGroup()}return t}))}r.group=group;function saveState(e,r){a.issueCommand("save-state",{name:e},r)}r.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}r.getState=getState},704:function(e,r,t){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,r,t,s){if(s===undefined)s=t;Object.defineProperty(e,s,{enumerable:true,get:function(){return r[t]}})}:function(e,r,t,s){if(s===undefined)s=t;e[s]=r[t]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(t!=="default"&&Object.hasOwnProperty.call(e,t))s(r,e,t);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.issueCommand=void 0;const i=n(t(747));const a=n(t(87));const c=t(163);function issueCommand(e,r){const t=process.env[`GITHUB_${e}`];if(!t){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!i.existsSync(t)){throw new Error(`Missing file at path: ${t}`)}i.appendFileSync(t,`${c.toCommandValue(r)}${a.EOL}`,{encoding:"utf8"})}r.issueCommand=issueCommand},163:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.toCommandValue=void 0;function toCommandValue(e){if(e===null||e===undefined){return""}else if(typeof e==="string"||e instanceof String){return e}return JSON.stringify(e)}r.toCommandValue=toCommandValue},466:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Context=void 0;const s=t(747);const o=t(87);class Context{constructor(){var e,r,t;this.payload={};if(process.env.GITHUB_EVENT_PATH){if(s.existsSync(process.env.GITHUB_EVENT_PATH)){this.payload=JSON.parse(s.readFileSync(process.env.GITHUB_EVENT_PATH,{encoding:"utf8"}))}else{const e=process.env.GITHUB_EVENT_PATH;process.stdout.write(`GITHUB_EVENT_PATH ${e} does not exist${o.EOL}`)}}this.eventName=process.env.GITHUB_EVENT_NAME;this.sha=process.env.GITHUB_SHA;this.ref=process.env.GITHUB_REF;this.workflow=process.env.GITHUB_WORKFLOW;this.action=process.env.GITHUB_ACTION;this.actor=process.env.GITHUB_ACTOR;this.job=process.env.GITHUB_JOB;this.runNumber=parseInt(process.env.GITHUB_RUN_NUMBER,10);this.runId=parseInt(process.env.GITHUB_RUN_ID,10);this.apiUrl=(e=process.env.GITHUB_API_URL)!==null&&e!==void 0?e:`https://api.github.com`;this.serverUrl=(r=process.env.GITHUB_SERVER_URL)!==null&&r!==void 0?r:`https://github.com`;this.graphqlUrl=(t=process.env.GITHUB_GRAPHQL_URL)!==null&&t!==void 0?t:`https://api.github.com/graphql`}get issue(){const e=this.payload;return Object.assign(Object.assign({},this.repo),{number:(e.issue||e.pull_request||e).number})}get repo(){if(process.env.GITHUB_REPOSITORY){const[e,r]=process.env.GITHUB_REPOSITORY.split("/");return{owner:e,repo:r}}if(this.payload.repository){return{owner:this.payload.repository.owner.login,repo:this.payload.repository.name}}throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'")}}r.Context=Context},366:function(e,r,t){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,r,t,s){if(s===undefined)s=t;Object.defineProperty(e,s,{enumerable:true,get:function(){return r[t]}})}:function(e,r,t,s){if(s===undefined)s=t;e[s]=r[t]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(t!=="default"&&Object.hasOwnProperty.call(e,t))s(r,e,t);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.getOctokit=r.context=void 0;const i=n(t(466));const a=t(862);r.context=new i.Context;function getOctokit(e,r){return new a.GitHub(a.getOctokitOptions(e,r))}r.getOctokit=getOctokit},574:function(e,r,t){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,r,t,s){if(s===undefined)s=t;Object.defineProperty(e,s,{enumerable:true,get:function(){return r[t]}})}:function(e,r,t,s){if(s===undefined)s=t;e[s]=r[t]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(t!=="default"&&Object.hasOwnProperty.call(e,t))s(r,e,t);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.getApiBaseUrl=r.getProxyAgent=r.getAuthString=void 0;const i=n(t(189));function getAuthString(e,r){if(!e&&!r.auth){throw new Error("Parameter token or opts.auth is required")}else if(e&&r.auth){throw new Error("Parameters token and opts.auth may not both be specified")}return typeof r.auth==="string"?r.auth:`token ${e}`}r.getAuthString=getAuthString;function getProxyAgent(e){const r=new i.HttpClient;return r.getAgent(e)}r.getProxyAgent=getProxyAgent;function getApiBaseUrl(){return process.env["GITHUB_API_URL"]||"https://api.github.com"}r.getApiBaseUrl=getApiBaseUrl},862:function(e,r,t){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,r,t,s){if(s===undefined)s=t;Object.defineProperty(e,s,{enumerable:true,get:function(){return r[t]}})}:function(e,r,t,s){if(s===undefined)s=t;e[s]=r[t]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(t!=="default"&&Object.hasOwnProperty.call(e,t))s(r,e,t);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.getOctokitOptions=r.GitHub=r.context=void 0;const i=n(t(466));const a=n(t(574));const c=t(362);const u=t(534);const p=t(433);r.context=new i.Context;const l=a.getApiBaseUrl();const d={baseUrl:l,request:{agent:a.getProxyAgent(l)}};r.GitHub=c.Octokit.plugin(u.restEndpointMethods,p.paginateRest).defaults(d);function getOctokitOptions(e,r){const t=Object.assign({},r||{});const s=a.getAuthString(e,t);if(s){t.auth=s}return t}r.getOctokitOptions=getOctokitOptions},189:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const s=t(605);const o=t(211);const n=t(851);let i;var a;(function(e){e[e["OK"]=200]="OK";e[e["MultipleChoices"]=300]="MultipleChoices";e[e["MovedPermanently"]=301]="MovedPermanently";e[e["ResourceMoved"]=302]="ResourceMoved";e[e["SeeOther"]=303]="SeeOther";e[e["NotModified"]=304]="NotModified";e[e["UseProxy"]=305]="UseProxy";e[e["SwitchProxy"]=306]="SwitchProxy";e[e["TemporaryRedirect"]=307]="TemporaryRedirect";e[e["PermanentRedirect"]=308]="PermanentRedirect";e[e["BadRequest"]=400]="BadRequest";e[e["Unauthorized"]=401]="Unauthorized";e[e["PaymentRequired"]=402]="PaymentRequired";e[e["Forbidden"]=403]="Forbidden";e[e["NotFound"]=404]="NotFound";e[e["MethodNotAllowed"]=405]="MethodNotAllowed";e[e["NotAcceptable"]=406]="NotAcceptable";e[e["ProxyAuthenticationRequired"]=407]="ProxyAuthenticationRequired";e[e["RequestTimeout"]=408]="RequestTimeout";e[e["Conflict"]=409]="Conflict";e[e["Gone"]=410]="Gone";e[e["TooManyRequests"]=429]="TooManyRequests";e[e["InternalServerError"]=500]="InternalServerError";e[e["NotImplemented"]=501]="NotImplemented";e[e["BadGateway"]=502]="BadGateway";e[e["ServiceUnavailable"]=503]="ServiceUnavailable";e[e["GatewayTimeout"]=504]="GatewayTimeout"})(a=r.HttpCodes||(r.HttpCodes={}));var c;(function(e){e["Accept"]="accept";e["ContentType"]="content-type"})(c=r.Headers||(r.Headers={}));var u;(function(e){e["ApplicationJson"]="application/json"})(u=r.MediaTypes||(r.MediaTypes={}));function getProxyUrl(e){let r=n.getProxyUrl(new URL(e));return r?r.href:""}r.getProxyUrl=getProxyUrl;const p=[a.MovedPermanently,a.ResourceMoved,a.SeeOther,a.TemporaryRedirect,a.PermanentRedirect];const l=[a.BadGateway,a.ServiceUnavailable,a.GatewayTimeout];const d=["OPTIONS","GET","DELETE","HEAD"];const m=10;const g=5;class HttpClientError extends Error{constructor(e,r){super(e);this.name="HttpClientError";this.statusCode=r;Object.setPrototypeOf(this,HttpClientError.prototype)}}r.HttpClientError=HttpClientError;class HttpClientResponse{constructor(e){this.message=e}readBody(){return new Promise((async(e,r)=>{let t=Buffer.alloc(0);this.message.on("data",(e=>{t=Buffer.concat([t,e])}));this.message.on("end",(()=>{e(t.toString())}))}))}}r.HttpClientResponse=HttpClientResponse;function isHttps(e){let r=new URL(e);return r.protocol==="https:"}r.isHttps=isHttps;class HttpClient{constructor(e,r,t){this._ignoreSslError=false;this._allowRedirects=true;this._allowRedirectDowngrade=false;this._maxRedirects=50;this._allowRetries=false;this._maxRetries=1;this._keepAlive=false;this._disposed=false;this.userAgent=e;this.handlers=r||[];this.requestOptions=t;if(t){if(t.ignoreSslError!=null){this._ignoreSslError=t.ignoreSslError}this._socketTimeout=t.socketTimeout;if(t.allowRedirects!=null){this._allowRedirects=t.allowRedirects}if(t.allowRedirectDowngrade!=null){this._allowRedirectDowngrade=t.allowRedirectDowngrade}if(t.maxRedirects!=null){this._maxRedirects=Math.max(t.maxRedirects,0)}if(t.keepAlive!=null){this._keepAlive=t.keepAlive}if(t.allowRetries!=null){this._allowRetries=t.allowRetries}if(t.maxRetries!=null){this._maxRetries=t.maxRetries}}}options(e,r){return this.request("OPTIONS",e,null,r||{})}get(e,r){return this.request("GET",e,null,r||{})}del(e,r){return this.request("DELETE",e,null,r||{})}post(e,r,t){return this.request("POST",e,r,t||{})}patch(e,r,t){return this.request("PATCH",e,r,t||{})}put(e,r,t){return this.request("PUT",e,r,t||{})}head(e,r){return this.request("HEAD",e,null,r||{})}sendStream(e,r,t,s){return this.request(e,r,t,s)}async getJson(e,r={}){r[c.Accept]=this._getExistingOrDefaultHeader(r,c.Accept,u.ApplicationJson);let t=await this.get(e,r);return this._processResponse(t,this.requestOptions)}async postJson(e,r,t={}){let s=JSON.stringify(r,null,2);t[c.Accept]=this._getExistingOrDefaultHeader(t,c.Accept,u.ApplicationJson);t[c.ContentType]=this._getExistingOrDefaultHeader(t,c.ContentType,u.ApplicationJson);let o=await this.post(e,s,t);return this._processResponse(o,this.requestOptions)}async putJson(e,r,t={}){let s=JSON.stringify(r,null,2);t[c.Accept]=this._getExistingOrDefaultHeader(t,c.Accept,u.ApplicationJson);t[c.ContentType]=this._getExistingOrDefaultHeader(t,c.ContentType,u.ApplicationJson);let o=await this.put(e,s,t);return this._processResponse(o,this.requestOptions)}async patchJson(e,r,t={}){let s=JSON.stringify(r,null,2);t[c.Accept]=this._getExistingOrDefaultHeader(t,c.Accept,u.ApplicationJson);t[c.ContentType]=this._getExistingOrDefaultHeader(t,c.ContentType,u.ApplicationJson);let o=await this.patch(e,s,t);return this._processResponse(o,this.requestOptions)}async request(e,r,t,s){if(this._disposed){throw new Error("Client has already been disposed.")}let o=new URL(r);let n=this._prepareRequest(e,o,s);let i=this._allowRetries&&d.indexOf(e)!=-1?this._maxRetries+1:1;let c=0;let u;while(c0){const i=u.message.headers["location"];if(!i){break}let a=new URL(i);if(o.protocol=="https:"&&o.protocol!=a.protocol&&!this._allowRedirectDowngrade){throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.")}await u.readBody();if(a.hostname!==o.hostname){for(let e in s){if(e.toLowerCase()==="authorization"){delete s[e]}}}n=this._prepareRequest(e,a,s);u=await this.requestRaw(n,t);r--}if(l.indexOf(u.message.statusCode)==-1){return u}c+=1;if(c{let callbackForResult=function(e,r){if(e){s(e)}t(r)};this.requestRawWithCallback(e,r,callbackForResult)}))}requestRawWithCallback(e,r,t){let s;if(typeof r==="string"){e.options.headers["Content-Length"]=Buffer.byteLength(r,"utf8")}let o=false;let handleResult=(e,r)=>{if(!o){o=true;t(e,r)}};let n=e.httpModule.request(e.options,(e=>{let r=new HttpClientResponse(e);handleResult(null,r)}));n.on("socket",(e=>{s=e}));n.setTimeout(this._socketTimeout||3*6e4,(()=>{if(s){s.end()}handleResult(new Error("Request timeout: "+e.options.path),null)}));n.on("error",(function(e){handleResult(e,null)}));if(r&&typeof r==="string"){n.write(r,"utf8")}if(r&&typeof r!=="string"){r.on("close",(function(){n.end()}));r.pipe(n)}else{n.end()}}getAgent(e){let r=new URL(e);return this._getAgent(r)}_prepareRequest(e,r,t){const n={};n.parsedUrl=r;const i=n.parsedUrl.protocol==="https:";n.httpModule=i?o:s;const a=i?443:80;n.options={};n.options.host=n.parsedUrl.hostname;n.options.port=n.parsedUrl.port?parseInt(n.parsedUrl.port):a;n.options.path=(n.parsedUrl.pathname||"")+(n.parsedUrl.search||"");n.options.method=e;n.options.headers=this._mergeHeaders(t);if(this.userAgent!=null){n.options.headers["user-agent"]=this.userAgent}n.options.agent=this._getAgent(n.parsedUrl);if(this.handlers){this.handlers.forEach((e=>{e.prepareRequest(n.options)}))}return n}_mergeHeaders(e){const lowercaseKeys=e=>Object.keys(e).reduce(((r,t)=>(r[t.toLowerCase()]=e[t],r)),{});if(this.requestOptions&&this.requestOptions.headers){return Object.assign({},lowercaseKeys(this.requestOptions.headers),lowercaseKeys(e))}return lowercaseKeys(e||{})}_getExistingOrDefaultHeader(e,r,t){const lowercaseKeys=e=>Object.keys(e).reduce(((r,t)=>(r[t.toLowerCase()]=e[t],r)),{});let s;if(this.requestOptions&&this.requestOptions.headers){s=lowercaseKeys(this.requestOptions.headers)[r]}return e[r]||s||t}_getAgent(e){let r;let a=n.getProxyUrl(e);let c=a&&a.hostname;if(this._keepAlive&&c){r=this._proxyAgent}if(this._keepAlive&&!c){r=this._agent}if(!!r){return r}const u=e.protocol==="https:";let p=100;if(!!this.requestOptions){p=this.requestOptions.maxSockets||s.globalAgent.maxSockets}if(c){if(!i){i=t(494)}const e={maxSockets:p,keepAlive:this._keepAlive,proxy:{...(a.username||a.password)&&{proxyAuth:`${a.username}:${a.password}`},host:a.hostname,port:a.port}};let s;const o=a.protocol==="https:";if(u){s=o?i.httpsOverHttps:i.httpsOverHttp}else{s=o?i.httpOverHttps:i.httpOverHttp}r=s(e);this._proxyAgent=r}if(this._keepAlive&&!r){const e={keepAlive:this._keepAlive,maxSockets:p};r=u?new o.Agent(e):new s.Agent(e);this._agent=r}if(!r){r=u?o.globalAgent:s.globalAgent}if(u&&this._ignoreSslError){r.options=Object.assign(r.options||{},{rejectUnauthorized:false})}return r}_performExponentialBackoff(e){e=Math.min(m,e);const r=g*Math.pow(2,e);return new Promise((e=>setTimeout((()=>e()),r)))}static dateTimeDeserializer(e,r){if(typeof r==="string"){let e=new Date(r);if(!isNaN(e.valueOf())){return e}}return r}async _processResponse(e,r){return new Promise((async(t,s)=>{const o=e.message.statusCode;const n={statusCode:o,result:null,headers:{}};if(o==a.NotFound){t(n)}let i;let c;try{c=await e.readBody();if(c&&c.length>0){if(r&&r.deserializeDates){i=JSON.parse(c,HttpClient.dateTimeDeserializer)}else{i=JSON.parse(c)}n.result=i}n.headers=e.message.headers}catch(e){}if(o>299){let e;if(i&&i.message){e=i.message}else if(c&&c.length>0){e=c}else{e="Failed request: ("+o+")"}let r=new HttpClientError(e,o);r.result=n.result;s(r)}else{t(n)}}))}}r.HttpClient=HttpClient},851:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});function getProxyUrl(e){let r=e.protocol==="https:";let t;if(checkBypass(e)){return t}let s;if(r){s=process.env["https_proxy"]||process.env["HTTPS_PROXY"]}else{s=process.env["http_proxy"]||process.env["HTTP_PROXY"]}if(s){t=new URL(s)}return t}r.getProxyUrl=getProxyUrl;function checkBypass(e){if(!e.hostname){return false}let r=process.env["no_proxy"]||process.env["NO_PROXY"]||"";if(!r){return false}let t;if(e.port){t=Number(e.port)}else if(e.protocol==="http:"){t=80}else if(e.protocol==="https:"){t=443}let s=[e.hostname.toUpperCase()];if(typeof t==="number"){s.push(`${s[0]}:${t}`)}for(let e of r.split(",").map((e=>e.trim().toUpperCase())).filter((e=>e))){if(s.some((r=>r===e))){return true}}return false}r.checkBypass=checkBypass},476:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});async function auth(e){const r=e.split(/\./).length===3?"app":/^v\d+\./.test(e)?"installation":"oauth";return{type:"token",token:e,tokenType:r}}function withAuthorizationPrefix(e){if(e.split(/\./).length===3){return`bearer ${e}`}return`token ${e}`}async function hook(e,r,t,s){const o=r.endpoint.merge(t,s);o.headers.authorization=withAuthorizationPrefix(e);return r(o)}const t=function createTokenAuth(e){if(!e){throw new Error("[@octokit/auth-token] No token passed to createTokenAuth")}if(typeof e!=="string"){throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string")}e=e.replace(/^(token|bearer) +/i,"");return Object.assign(auth.bind(null,e),{hook:hook.bind(null,e)})};r.createTokenAuth=t},362:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});var s=t(147);var o=t(218);var n=t(422);var i=t(278);var a=t(476);function _objectWithoutPropertiesLoose(e,r){if(e==null)return{};var t={};var s=Object.keys(e);var o,n;for(n=0;n=0)continue;t[o]=e[o]}return t}function _objectWithoutProperties(e,r){if(e==null)return{};var t=_objectWithoutPropertiesLoose(e,r);var s,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,s))continue;t[s]=e[s]}}return t}const c="3.5.1";const u=["authStrategy"];class Octokit{constructor(e={}){const r=new o.Collection;const t={baseUrl:n.request.endpoint.DEFAULTS.baseUrl,headers:{},request:Object.assign({},e.request,{hook:r.bind(null,"request")}),mediaType:{previews:[],format:""}};t.headers["user-agent"]=[e.userAgent,`octokit-core.js/${c} ${s.getUserAgent()}`].filter(Boolean).join(" ");if(e.baseUrl){t.baseUrl=e.baseUrl}if(e.previews){t.mediaType.previews=e.previews}if(e.timeZone){t.headers["time-zone"]=e.timeZone}this.request=n.request.defaults(t);this.graphql=i.withCustomRequest(this.request).defaults(t);this.log=Object.assign({debug:()=>{},info:()=>{},warn:console.warn.bind(console),error:console.error.bind(console)},e.log);this.hook=r;if(!e.authStrategy){if(!e.auth){this.auth=async()=>({type:"unauthenticated"})}else{const t=a.createTokenAuth(e.auth);r.wrap("request",t.hook);this.auth=t}}else{const{authStrategy:t}=e,s=_objectWithoutProperties(e,u);const o=t(Object.assign({request:this.request,log:this.log,octokit:this,octokitOptions:s},e.auth));r.wrap("request",o.hook);this.auth=o}const p=this.constructor;p.plugins.forEach((r=>{Object.assign(this,r(this,e))}))}static defaults(e){const r=class extends(this){constructor(...r){const t=r[0]||{};if(typeof e==="function"){super(e(t));return}super(Object.assign({},e,t,t.userAgent&&e.userAgent?{userAgent:`${t.userAgent} ${e.userAgent}`}:null))}};return r}static plugin(...e){var r;const t=this.plugins;const s=(r=class extends(this){},r.plugins=t.concat(e.filter((e=>!t.includes(e)))),r);return s}}Octokit.VERSION=c;Octokit.plugins=[];r.Octokit=Octokit},143:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});var s=t(793);var o=t(147);function lowercaseKeys(e){if(!e){return{}}return Object.keys(e).reduce(((r,t)=>{r[t.toLowerCase()]=e[t];return r}),{})}function mergeDeep(e,r){const t=Object.assign({},e);Object.keys(r).forEach((o=>{if(s.isPlainObject(r[o])){if(!(o in e))Object.assign(t,{[o]:r[o]});else t[o]=mergeDeep(e[o],r[o])}else{Object.assign(t,{[o]:r[o]})}}));return t}function removeUndefinedProperties(e){for(const r in e){if(e[r]===undefined){delete e[r]}}return e}function merge(e,r,t){if(typeof r==="string"){let[e,s]=r.split(" ");t=Object.assign(s?{method:e,url:s}:{url:e},t)}else{t=Object.assign({},r)}t.headers=lowercaseKeys(t.headers);removeUndefinedProperties(t);removeUndefinedProperties(t.headers);const s=mergeDeep(e||{},t);if(e&&e.mediaType.previews.length){s.mediaType.previews=e.mediaType.previews.filter((e=>!s.mediaType.previews.includes(e))).concat(s.mediaType.previews)}s.mediaType.previews=s.mediaType.previews.map((e=>e.replace(/-preview/,"")));return s}function addQueryParameters(e,r){const t=/\?/.test(e)?"&":"?";const s=Object.keys(r);if(s.length===0){return e}return e+t+s.map((e=>{if(e==="q"){return"q="+r.q.split("+").map(encodeURIComponent).join("+")}return`${e}=${encodeURIComponent(r[e])}`})).join("&")}const n=/\{[^}]+\}/g;function removeNonChars(e){return e.replace(/^\W+|\W+$/g,"").split(/,/)}function extractUrlVariableNames(e){const r=e.match(n);if(!r){return[]}return r.map(removeNonChars).reduce(((e,r)=>e.concat(r)),[])}function omit(e,r){return Object.keys(e).filter((e=>!r.includes(e))).reduce(((r,t)=>{r[t]=e[t];return r}),{})}function encodeReserved(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map((function(e){if(!/%[0-9A-Fa-f]/.test(e)){e=encodeURI(e).replace(/%5B/g,"[").replace(/%5D/g,"]")}return e})).join("")}function encodeUnreserved(e){return encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function encodeValue(e,r,t){r=e==="+"||e==="#"?encodeReserved(r):encodeUnreserved(r);if(t){return encodeUnreserved(t)+"="+r}else{return r}}function isDefined(e){return e!==undefined&&e!==null}function isKeyOperator(e){return e===";"||e==="&"||e==="?"}function getValues(e,r,t,s){var o=e[t],n=[];if(isDefined(o)&&o!==""){if(typeof o==="string"||typeof o==="number"||typeof o==="boolean"){o=o.toString();if(s&&s!=="*"){o=o.substring(0,parseInt(s,10))}n.push(encodeValue(r,o,isKeyOperator(r)?t:""))}else{if(s==="*"){if(Array.isArray(o)){o.filter(isDefined).forEach((function(e){n.push(encodeValue(r,e,isKeyOperator(r)?t:""))}))}else{Object.keys(o).forEach((function(e){if(isDefined(o[e])){n.push(encodeValue(r,o[e],e))}}))}}else{const e=[];if(Array.isArray(o)){o.filter(isDefined).forEach((function(t){e.push(encodeValue(r,t))}))}else{Object.keys(o).forEach((function(t){if(isDefined(o[t])){e.push(encodeUnreserved(t));e.push(encodeValue(r,o[t].toString()))}}))}if(isKeyOperator(r)){n.push(encodeUnreserved(t)+"="+e.join(","))}else if(e.length!==0){n.push(e.join(","))}}}}else{if(r===";"){if(isDefined(o)){n.push(encodeUnreserved(t))}}else if(o===""&&(r==="&"||r==="?")){n.push(encodeUnreserved(t)+"=")}else if(o===""){n.push("")}}return n}function parseUrl(e){return{expand:expand.bind(null,e)}}function expand(e,r){var t=["+","#",".","/",";","?","&"];return e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,(function(e,s,o){if(s){let e="";const o=[];if(t.indexOf(s.charAt(0))!==-1){e=s.charAt(0);s=s.substr(1)}s.split(/,/g).forEach((function(t){var s=/([^:\*]*)(?::(\d+)|(\*))?/.exec(t);o.push(getValues(r,e,s[1],s[2]||s[3]))}));if(e&&e!=="+"){var n=",";if(e==="?"){n="&"}else if(e!=="#"){n=e}return(o.length!==0?e:"")+o.join(n)}else{return o.join(",")}}else{return encodeReserved(o)}}))}function parse(e){let r=e.method.toUpperCase();let t=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}");let s=Object.assign({},e.headers);let o;let n=omit(e,["method","baseUrl","url","headers","request","mediaType"]);const i=extractUrlVariableNames(t);t=parseUrl(t).expand(n);if(!/^http/.test(t)){t=e.baseUrl+t}const a=Object.keys(e).filter((e=>i.includes(e))).concat("baseUrl");const c=omit(n,a);const u=/application\/octet-stream/i.test(s.accept);if(!u){if(e.mediaType.format){s.accept=s.accept.split(/,/).map((r=>r.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`))).join(",")}if(e.mediaType.previews.length){const r=s.accept.match(/[\w-]+(?=-preview)/g)||[];s.accept=r.concat(e.mediaType.previews).map((r=>{const t=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${r}-preview${t}`})).join(",")}}if(["GET","HEAD"].includes(r)){t=addQueryParameters(t,c)}else{if("data"in c){o=c.data}else{if(Object.keys(c).length){o=c}else{s["content-length"]=0}}}if(!s["content-type"]&&typeof o!=="undefined"){s["content-type"]="application/json; charset=utf-8"}if(["PATCH","PUT"].includes(r)&&typeof o==="undefined"){o=""}return Object.assign({method:r,url:t,headers:s},typeof o!=="undefined"?{body:o}:null,e.request?{request:e.request}:null)}function endpointWithDefaults(e,r,t){return parse(merge(e,r,t))}function withDefaults(e,r){const t=merge(e,r);const s=endpointWithDefaults.bind(null,t);return Object.assign(s,{DEFAULTS:t,defaults:withDefaults.bind(null,t),merge:merge.bind(null,t),parse:parse})}const i="6.0.12";const a=`octokit-endpoint.js/${i} ${o.getUserAgent()}`;const c={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":a},mediaType:{format:"",previews:[]}};const u=withDefaults(null,c);r.endpoint=u},278:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});var s=t(422);var o=t(147);const n="4.6.4";class GraphqlError extends Error{constructor(e,r){const t=r.data.errors[0].message;super(t);Object.assign(this,r.data);Object.assign(this,{headers:r.headers});this.name="GraphqlError";this.request=e;if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}}}const i=["method","baseUrl","url","headers","request","query","mediaType"];const a=["query","method","url"];const c=/\/api\/v3\/?$/;function graphql(e,r,t){if(t){if(typeof r==="string"&&"query"in t){return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`))}for(const e in t){if(!a.includes(e))continue;return Promise.reject(new Error(`[@octokit/graphql] "${e}" cannot be used as variable name`))}}const s=typeof r==="string"?Object.assign({query:r},t):r;const o=Object.keys(s).reduce(((e,r)=>{if(i.includes(r)){e[r]=s[r];return e}if(!e.variables){e.variables={}}e.variables[r]=s[r];return e}),{});const n=s.baseUrl||e.endpoint.DEFAULTS.baseUrl;if(c.test(n)){o.url=n.replace(c,"/api/graphql")}return e(o).then((e=>{if(e.data.errors){const r={};for(const t of Object.keys(e.headers)){r[t]=e.headers[t]}throw new GraphqlError(o,{headers:r,data:e.data})}return e.data.data}))}function withDefaults(e,r){const t=e.defaults(r);const newApi=(e,r)=>graphql(t,e,r);return Object.assign(newApi,{defaults:withDefaults.bind(null,t),endpoint:s.request.endpoint})}const u=withDefaults(s.request,{headers:{"user-agent":`octokit-graphql.js/${n} ${o.getUserAgent()}`},method:"POST",url:"/graphql"});function withCustomRequest(e){return withDefaults(e,{method:"POST",url:"/graphql"})}r.graphql=u;r.withCustomRequest=withCustomRequest},433:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const t="2.15.0";function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);if(r){s=s.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))}t.push.apply(t,s)}return t}function _objectSpread2(e){for(var r=1;r({async next(){if(!a)return{done:true};try{const e=await o({method:n,url:a,headers:i});const r=normalizePaginatedListResponse(e);a=((r.headers.link||"").match(/<([^>]+)>;\s*rel="next"/)||[])[1];return{value:r}}catch(e){if(e.status!==409)throw e;a="";return{value:{status:200,headers:{},data:[]}}}}})}}function paginate(e,r,t,s){if(typeof t==="function"){s=t;t=undefined}return gather(e,[],iterator(e,r,t)[Symbol.asyncIterator](),s)}function gather(e,r,t,s){return t.next().then((o=>{if(o.done){return r}let n=false;function done(){n=true}r=r.concat(s?s(o.value,done):o.value.data);if(n){return r}return gather(e,r,t,s)}))}const s=Object.assign(paginate,{iterator:iterator});const o=["GET /app/hook/deliveries","GET /app/installations","GET /applications/grants","GET /authorizations","GET /enterprises/{enterprise}/actions/permissions/organizations","GET /enterprises/{enterprise}/actions/runner-groups","GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations","GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners","GET /enterprises/{enterprise}/actions/runners","GET /enterprises/{enterprise}/actions/runners/downloads","GET /events","GET /gists","GET /gists/public","GET /gists/starred","GET /gists/{gist_id}/comments","GET /gists/{gist_id}/commits","GET /gists/{gist_id}/forks","GET /installation/repositories","GET /issues","GET /marketplace_listing/plans","GET /marketplace_listing/plans/{plan_id}/accounts","GET /marketplace_listing/stubbed/plans","GET /marketplace_listing/stubbed/plans/{plan_id}/accounts","GET /networks/{owner}/{repo}/events","GET /notifications","GET /organizations","GET /orgs/{org}/actions/permissions/repositories","GET /orgs/{org}/actions/runner-groups","GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories","GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners","GET /orgs/{org}/actions/runners","GET /orgs/{org}/actions/runners/downloads","GET /orgs/{org}/actions/secrets","GET /orgs/{org}/actions/secrets/{secret_name}/repositories","GET /orgs/{org}/blocks","GET /orgs/{org}/credential-authorizations","GET /orgs/{org}/events","GET /orgs/{org}/failed_invitations","GET /orgs/{org}/hooks","GET /orgs/{org}/hooks/{hook_id}/deliveries","GET /orgs/{org}/installations","GET /orgs/{org}/invitations","GET /orgs/{org}/invitations/{invitation_id}/teams","GET /orgs/{org}/issues","GET /orgs/{org}/members","GET /orgs/{org}/migrations","GET /orgs/{org}/migrations/{migration_id}/repositories","GET /orgs/{org}/outside_collaborators","GET /orgs/{org}/projects","GET /orgs/{org}/public_members","GET /orgs/{org}/repos","GET /orgs/{org}/team-sync/groups","GET /orgs/{org}/teams","GET /orgs/{org}/teams/{team_slug}/discussions","GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments","GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions","GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions","GET /orgs/{org}/teams/{team_slug}/invitations","GET /orgs/{org}/teams/{team_slug}/members","GET /orgs/{org}/teams/{team_slug}/projects","GET /orgs/{org}/teams/{team_slug}/repos","GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings","GET /orgs/{org}/teams/{team_slug}/teams","GET /projects/columns/{column_id}/cards","GET /projects/{project_id}/collaborators","GET /projects/{project_id}/columns","GET /repos/{owner}/{repo}/actions/artifacts","GET /repos/{owner}/{repo}/actions/runners","GET /repos/{owner}/{repo}/actions/runners/downloads","GET /repos/{owner}/{repo}/actions/runs","GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts","GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs","GET /repos/{owner}/{repo}/actions/secrets","GET /repos/{owner}/{repo}/actions/workflows","GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs","GET /repos/{owner}/{repo}/assignees","GET /repos/{owner}/{repo}/autolinks","GET /repos/{owner}/{repo}/branches","GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations","GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs","GET /repos/{owner}/{repo}/code-scanning/alerts","GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances","GET /repos/{owner}/{repo}/code-scanning/analyses","GET /repos/{owner}/{repo}/collaborators","GET /repos/{owner}/{repo}/comments","GET /repos/{owner}/{repo}/comments/{comment_id}/reactions","GET /repos/{owner}/{repo}/commits","GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head","GET /repos/{owner}/{repo}/commits/{commit_sha}/comments","GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls","GET /repos/{owner}/{repo}/commits/{ref}/check-runs","GET /repos/{owner}/{repo}/commits/{ref}/check-suites","GET /repos/{owner}/{repo}/commits/{ref}/statuses","GET /repos/{owner}/{repo}/contributors","GET /repos/{owner}/{repo}/deployments","GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses","GET /repos/{owner}/{repo}/events","GET /repos/{owner}/{repo}/forks","GET /repos/{owner}/{repo}/git/matching-refs/{ref}","GET /repos/{owner}/{repo}/hooks","GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries","GET /repos/{owner}/{repo}/invitations","GET /repos/{owner}/{repo}/issues","GET /repos/{owner}/{repo}/issues/comments","GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions","GET /repos/{owner}/{repo}/issues/events","GET /repos/{owner}/{repo}/issues/{issue_number}/comments","GET /repos/{owner}/{repo}/issues/{issue_number}/events","GET /repos/{owner}/{repo}/issues/{issue_number}/labels","GET /repos/{owner}/{repo}/issues/{issue_number}/reactions","GET /repos/{owner}/{repo}/issues/{issue_number}/timeline","GET /repos/{owner}/{repo}/keys","GET /repos/{owner}/{repo}/labels","GET /repos/{owner}/{repo}/milestones","GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels","GET /repos/{owner}/{repo}/notifications","GET /repos/{owner}/{repo}/pages/builds","GET /repos/{owner}/{repo}/projects","GET /repos/{owner}/{repo}/pulls","GET /repos/{owner}/{repo}/pulls/comments","GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions","GET /repos/{owner}/{repo}/pulls/{pull_number}/comments","GET /repos/{owner}/{repo}/pulls/{pull_number}/commits","GET /repos/{owner}/{repo}/pulls/{pull_number}/files","GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers","GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews","GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments","GET /repos/{owner}/{repo}/releases","GET /repos/{owner}/{repo}/releases/{release_id}/assets","GET /repos/{owner}/{repo}/secret-scanning/alerts","GET /repos/{owner}/{repo}/stargazers","GET /repos/{owner}/{repo}/subscribers","GET /repos/{owner}/{repo}/tags","GET /repos/{owner}/{repo}/teams","GET /repositories","GET /repositories/{repository_id}/environments/{environment_name}/secrets","GET /scim/v2/enterprises/{enterprise}/Groups","GET /scim/v2/enterprises/{enterprise}/Users","GET /scim/v2/organizations/{org}/Users","GET /search/code","GET /search/commits","GET /search/issues","GET /search/labels","GET /search/repositories","GET /search/topics","GET /search/users","GET /teams/{team_id}/discussions","GET /teams/{team_id}/discussions/{discussion_number}/comments","GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions","GET /teams/{team_id}/discussions/{discussion_number}/reactions","GET /teams/{team_id}/invitations","GET /teams/{team_id}/members","GET /teams/{team_id}/projects","GET /teams/{team_id}/repos","GET /teams/{team_id}/team-sync/group-mappings","GET /teams/{team_id}/teams","GET /user/blocks","GET /user/emails","GET /user/followers","GET /user/following","GET /user/gpg_keys","GET /user/installations","GET /user/installations/{installation_id}/repositories","GET /user/issues","GET /user/keys","GET /user/marketplace_purchases","GET /user/marketplace_purchases/stubbed","GET /user/memberships/orgs","GET /user/migrations","GET /user/migrations/{migration_id}/repositories","GET /user/orgs","GET /user/public_emails","GET /user/repos","GET /user/repository_invitations","GET /user/starred","GET /user/subscriptions","GET /user/teams","GET /users","GET /users/{username}/events","GET /users/{username}/events/orgs/{org}","GET /users/{username}/events/public","GET /users/{username}/followers","GET /users/{username}/following","GET /users/{username}/gists","GET /users/{username}/gpg_keys","GET /users/{username}/keys","GET /users/{username}/orgs","GET /users/{username}/projects","GET /users/{username}/received_events","GET /users/{username}/received_events/public","GET /users/{username}/repos","GET /users/{username}/starred","GET /users/{username}/subscriptions"];function isPaginatingEndpoint(e){if(typeof e==="string"){return o.includes(e)}else{return false}}function paginateRest(e){return{paginate:Object.assign(paginate.bind(null,e),{iterator:iterator.bind(null,e)})}}paginateRest.VERSION=t;r.composePaginateRest=s;r.isPaginatingEndpoint=isPaginatingEndpoint;r.paginateRest=paginateRest;r.paginatingEndpoints=o},534:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);if(r){s=s.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))}t.push.apply(t,s)}return t}function _objectSpread2(e){for(var r=1;r{"use strict";Object.defineProperty(r,"__esModule",{value:true});function _interopDefault(e){return e&&typeof e==="object"&&"default"in e?e["default"]:e}var s=t(132);var o=_interopDefault(t(352));const n=o((e=>console.warn(e)));const i=o((e=>console.warn(e)));class RequestError extends Error{constructor(e,r,t){super(e);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}this.name="HttpError";this.status=r;let o;if("headers"in t&&typeof t.headers!=="undefined"){o=t.headers}if("response"in t){this.response=t.response;o=t.response.headers}const a=Object.assign({},t.request);if(t.request.headers.authorization){a.headers=Object.assign({},t.request.headers,{authorization:t.request.headers.authorization.replace(/ .*$/," [REDACTED]")})}a.url=a.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]");this.request=a;Object.defineProperty(this,"code",{get(){n(new s.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));return r}});Object.defineProperty(this,"headers",{get(){i(new s.Deprecation("[@octokit/request-error] `error.headers` is deprecated, use `error.response.headers`."));return o||{}}})}}r.RequestError=RequestError},422:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});function _interopDefault(e){return e&&typeof e==="object"&&"default"in e?e["default"]:e}var s=t(143);var o=t(147);var n=t(793);var i=_interopDefault(t(32));var a=t(603);const c="5.6.0";function getBufferResponse(e){return e.arrayBuffer()}function fetchWrapper(e){const r=e.request&&e.request.log?e.request.log:console;if(n.isPlainObject(e.body)||Array.isArray(e.body)){e.body=JSON.stringify(e.body)}let t={};let s;let o;const c=e.request&&e.request.fetch||i;return c(e.url,Object.assign({method:e.method,body:e.body,headers:e.headers,redirect:e.redirect},e.request)).then((async n=>{o=n.url;s=n.status;for(const e of n.headers){t[e[0]]=e[1]}if("deprecation"in t){const s=t.link&&t.link.match(/<([^>]+)>; rel="deprecation"/);const o=s&&s.pop();r.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${t.sunset}${o?`. See ${o}`:""}`)}if(s===204||s===205){return}if(e.method==="HEAD"){if(s<400){return}throw new a.RequestError(n.statusText,s,{response:{url:o,status:s,headers:t,data:undefined},request:e})}if(s===304){throw new a.RequestError("Not modified",s,{response:{url:o,status:s,headers:t,data:await getResponseData(n)},request:e})}if(s>=400){const r=await getResponseData(n);const i=new a.RequestError(toErrorMessage(r),s,{response:{url:o,status:s,headers:t,data:r},request:e});throw i}return getResponseData(n)})).then((e=>({status:s,url:o,headers:t,data:e}))).catch((r=>{if(r instanceof a.RequestError)throw r;throw new a.RequestError(r.message,500,{request:e})}))}async function getResponseData(e){const r=e.headers.get("content-type");if(/application\/json/.test(r)){return e.json()}if(!r||/^text\/|charset=utf-8$/.test(r)){return e.text()}return getBufferResponse(e)}function toErrorMessage(e){if(typeof e==="string")return e;if("message"in e){if(Array.isArray(e.errors)){return`${e.message}: ${e.errors.map(JSON.stringify).join(", ")}`}return e.message}return`Unknown error: ${JSON.stringify(e)}`}function withDefaults(e,r){const t=e.defaults(r);const newApi=function(e,r){const s=t.merge(e,r);if(!s.request||!s.request.hook){return fetchWrapper(t.parse(s))}const request=(e,r)=>fetchWrapper(t.parse(t.merge(e,r)));Object.assign(request,{endpoint:t,defaults:withDefaults.bind(null,t)});return s.request.hook(request,s)};return Object.assign(newApi,{endpoint:t,defaults:withDefaults.bind(null,t)})}const u=withDefaults(s.endpoint,{headers:{"user-agent":`octokit-request.js/${c} ${o.getUserAgent()}`}});r.request=u},218:(e,r,t)=>{var s=t(523);var o=t(3);var n=t(693);var i=Function.bind;var a=i.bind(i);function bindApi(e,r,t){var s=a(n,null).apply(null,t?[r,t]:[r]);e.api={remove:s};e.remove=s;["before","error","after","wrap"].forEach((function(s){var n=t?[r,s,t]:[r,s];e[s]=e.api[s]=a(o,null).apply(null,n)}))}function HookSingular(){var e="h";var r={registry:{}};var t=s.bind(null,r,e);bindApi(t,r,e);return t}function HookCollection(){var e={registry:{}};var r=s.bind(null,e);bindApi(r,e);return r}var c=false;function Hook(){if(!c){console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4');c=true}return HookCollection()}Hook.Singular=HookSingular.bind();Hook.Collection=HookCollection.bind();e.exports=Hook;e.exports.Hook=Hook;e.exports.Singular=Hook.Singular;e.exports.Collection=Hook.Collection},3:e=>{e.exports=addHook;function addHook(e,r,t,s){var o=s;if(!e.registry[t]){e.registry[t]=[]}if(r==="before"){s=function(e,r){return Promise.resolve().then(o.bind(null,r)).then(e.bind(null,r))}}if(r==="after"){s=function(e,r){var t;return Promise.resolve().then(e.bind(null,r)).then((function(e){t=e;return o(t,r)})).then((function(){return t}))}}if(r==="error"){s=function(e,r){return Promise.resolve().then(e.bind(null,r)).catch((function(e){return o(e,r)}))}}e.registry[t].push({hook:s,orig:o})}},523:e=>{e.exports=register;function register(e,r,t,s){if(typeof t!=="function"){throw new Error("method for before hook must be a function")}if(!s){s={}}if(Array.isArray(r)){return r.reverse().reduce((function(r,t){return register.bind(null,e,t,r,s)}),t)()}return Promise.resolve().then((function(){if(!e.registry[r]){return t(s)}return e.registry[r].reduce((function(e,r){return r.hook.bind(null,e,s)}),t)()}))}},693:e=>{e.exports=removeHook;function removeHook(e,r,t){if(!e.registry[r]){return}var s=e.registry[r].map((function(e){return e.orig})).indexOf(t);if(s===-1){return}e.registry[r].splice(s,1)}},132:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});class Deprecation extends Error{constructor(e){super(e);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}this.name="Deprecation"}}r.Deprecation=Deprecation},793:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true}); +/*! + * is-plain-object + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var r,t;if(isObject(e)===false)return false;r=e.constructor;if(r===undefined)return true;t=r.prototype;if(isObject(t)===false)return false;if(t.hasOwnProperty("isPrototypeOf")===false){return false}return true}r.isPlainObject=isPlainObject},32:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});function _interopDefault(e){return e&&typeof e==="object"&&"default"in e?e["default"]:e}var s=_interopDefault(t(413));var o=_interopDefault(t(605));var n=_interopDefault(t(835));var i=_interopDefault(t(211));var a=_interopDefault(t(761));const c=s.Readable;const u=Symbol("buffer");const p=Symbol("type");class Blob{constructor(){this[p]="";const e=arguments[0];const r=arguments[1];const t=[];let s=0;if(e){const r=e;const o=Number(r.length);for(let e=0;e1&&arguments[1]!==undefined?arguments[1]:{},o=t.size;let n=o===undefined?0:o;var i=t.timeout;let a=i===undefined?0:i;if(e==null){e=null}else if(isURLSearchParams(e)){e=Buffer.from(e.toString())}else if(isBlob(e));else if(Buffer.isBuffer(e));else if(Object.prototype.toString.call(e)==="[object ArrayBuffer]"){e=Buffer.from(e)}else if(ArrayBuffer.isView(e)){e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(e instanceof s);else{e=Buffer.from(String(e))}this[d]={body:e,disturbed:false,error:null};this.size=n;this.timeout=a;if(e instanceof s){e.on("error",(function(e){const t=e.name==="AbortError"?e:new FetchError(`Invalid response body while trying to fetch ${r.url}: ${e.message}`,"system",e);r[d].error=t}))}}Body.prototype={get body(){return this[d].body},get bodyUsed(){return this[d].disturbed},arrayBuffer(){return consumeBody.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return consumeBody.call(this).then((function(r){return Object.assign(new Blob([],{type:e.toLowerCase()}),{[u]:r})}))},json(){var e=this;return consumeBody.call(this).then((function(r){try{return JSON.parse(r.toString())}catch(r){return Body.Promise.reject(new FetchError(`invalid json response body at ${e.url} reason: ${r.message}`,"invalid-json"))}}))},text(){return consumeBody.call(this).then((function(e){return e.toString()}))},buffer(){return consumeBody.call(this)},textConverted(){var e=this;return consumeBody.call(this).then((function(r){return convertBody(r,e.headers)}))}};Object.defineProperties(Body.prototype,{body:{enumerable:true},bodyUsed:{enumerable:true},arrayBuffer:{enumerable:true},blob:{enumerable:true},json:{enumerable:true},text:{enumerable:true}});Body.mixIn=function(e){for(const r of Object.getOwnPropertyNames(Body.prototype)){if(!(r in e)){const t=Object.getOwnPropertyDescriptor(Body.prototype,r);Object.defineProperty(e,r,t)}}};function consumeBody(){var e=this;if(this[d].disturbed){return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`))}this[d].disturbed=true;if(this[d].error){return Body.Promise.reject(this[d].error)}let r=this.body;if(r===null){return Body.Promise.resolve(Buffer.alloc(0))}if(isBlob(r)){r=r.stream()}if(Buffer.isBuffer(r)){return Body.Promise.resolve(r)}if(!(r instanceof s)){return Body.Promise.resolve(Buffer.alloc(0))}let t=[];let o=0;let n=false;return new Body.Promise((function(s,i){let a;if(e.timeout){a=setTimeout((function(){n=true;i(new FetchError(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)}r.on("error",(function(r){if(r.name==="AbortError"){n=true;i(r)}else{i(new FetchError(`Invalid response body while trying to fetch ${e.url}: ${r.message}`,"system",r))}}));r.on("data",(function(r){if(n||r===null){return}if(e.size&&o+r.length>e.size){n=true;i(new FetchError(`content size at ${e.url} over limit: ${e.size}`,"max-size"));return}o+=r.length;t.push(r)}));r.on("end",(function(){if(n){return}clearTimeout(a);try{s(Buffer.concat(t,o))}catch(r){i(new FetchError(`Could not create Buffer from response body for ${e.url}: ${r.message}`,"system",r))}}))}))}function convertBody(e,r){if(typeof l!=="function"){throw new Error("The package `encoding` must be installed to use the textConverted() function")}const t=r.get("content-type");let s="utf-8";let o,n;if(t){o=/charset=([^;]*)/i.exec(t)}n=e.slice(0,1024).toString();if(!o&&n){o=/0&&arguments[0]!==undefined?arguments[0]:undefined;this[T]=Object.create(null);if(e instanceof Headers){const r=e.raw();const t=Object.keys(r);for(const e of t){for(const t of r[e]){this.append(e,t)}}return}if(e==null);else if(typeof e==="object"){const r=e[Symbol.iterator];if(r!=null){if(typeof r!=="function"){throw new TypeError("Header pairs must be iterable")}const t=[];for(const r of e){if(typeof r!=="object"||typeof r[Symbol.iterator]!=="function"){throw new TypeError("Each header pair must be iterable")}t.push(Array.from(r))}for(const e of t){if(e.length!==2){throw new TypeError("Each header pair must be a name/value tuple")}this.append(e[0],e[1])}}else{for(const r of Object.keys(e)){const t=e[r];this.append(r,t)}}}else{throw new TypeError("Provided initializer must be an object")}}get(e){e=`${e}`;validateName(e);const r=find(this[T],e);if(r===undefined){return null}return this[T][r].join(", ")}forEach(e){let r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:undefined;let t=getHeaders(this);let s=0;while(s1&&arguments[1]!==undefined?arguments[1]:"key+value";const t=Object.keys(e[T]).sort();return t.map(r==="key"?function(e){return e.toLowerCase()}:r==="value"?function(r){return e[T][r].join(", ")}:function(r){return[r.toLowerCase(),e[T][r].join(", ")]})}const E=Symbol("internal");function createHeadersIterator(e,r){const t=Object.create(b);t[E]={target:e,kind:r,index:0};return t}const b=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==b){throw new TypeError("Value of `this` is not a HeadersIterator")}var e=this[E];const r=e.target,t=e.kind,s=e.index;const o=getHeaders(r,t);const n=o.length;if(s>=n){return{value:undefined,done:true}}this[E].index=s+1;return{value:o[s],done:false}}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));Object.defineProperty(b,Symbol.toStringTag,{value:"HeadersIterator",writable:false,enumerable:false,configurable:true});function exportNodeCompatibleHeaders(e){const r=Object.assign({__proto__:null},e[T]);const t=find(e[T],"Host");if(t!==undefined){r[t]=r[t][0]}return r}function createHeadersLenient(e){const r=new Headers;for(const t of Object.keys(e)){if(g.test(t)){continue}if(Array.isArray(e[t])){for(const s of e[t]){if(h.test(s)){continue}if(r[T][t]===undefined){r[T][t]=[s]}else{r[T][t].push(s)}}}else if(!h.test(e[t])){r[T][t]=[e[t]]}}return r}const w=Symbol("Response internals");const _=o.STATUS_CODES;class Response{constructor(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;let r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};Body.call(this,e,r);const t=r.status||200;const s=new Headers(r.headers);if(e!=null&&!s.has("Content-Type")){const r=extractContentType(e);if(r){s.append("Content-Type",r)}}this[w]={url:r.url,status:t,statusText:r.statusText||_[t],headers:s,counter:r.counter}}get url(){return this[w].url||""}get status(){return this[w].status}get ok(){return this[w].status>=200&&this[w].status<300}get redirected(){return this[w].counter>0}get statusText(){return this[w].statusText}get headers(){return this[w].headers}clone(){return new Response(clone(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}Body.mixIn(Response.prototype);Object.defineProperties(Response.prototype,{url:{enumerable:true},status:{enumerable:true},ok:{enumerable:true},redirected:{enumerable:true},statusText:{enumerable:true},headers:{enumerable:true},clone:{enumerable:true}});Object.defineProperty(Response.prototype,Symbol.toStringTag,{value:"Response",writable:false,enumerable:false,configurable:true});const y=Symbol("Request internals");const v=n.parse;const G=n.format;const k="destroy"in s.Readable.prototype;function isRequest(e){return typeof e==="object"&&typeof e[y]==="object"}function isAbortSignal(e){const r=e&&typeof e==="object"&&Object.getPrototypeOf(e);return!!(r&&r.constructor.name==="AbortSignal")}class Request{constructor(e){let r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let t;if(!isRequest(e)){if(e&&e.href){t=v(e.href)}else{t=v(`${e}`)}e={}}else{t=v(e.url)}let s=r.method||e.method||"GET";s=s.toUpperCase();if((r.body!=null||isRequest(e)&&e.body!==null)&&(s==="GET"||s==="HEAD")){throw new TypeError("Request with GET/HEAD method cannot have body")}let o=r.body!=null?r.body:isRequest(e)&&e.body!==null?clone(e):null;Body.call(this,o,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});const n=new Headers(r.headers||e.headers||{});if(o!=null&&!n.has("Content-Type")){const e=extractContentType(o);if(e){n.append("Content-Type",e)}}let i=isRequest(e)?e.signal:null;if("signal"in r)i=r.signal;if(i!=null&&!isAbortSignal(i)){throw new TypeError("Expected signal to be an instanceof AbortSignal")}this[y]={method:s,redirect:r.redirect||e.redirect||"follow",headers:n,parsedURL:t,signal:i};this.follow=r.follow!==undefined?r.follow:e.follow!==undefined?e.follow:20;this.compress=r.compress!==undefined?r.compress:e.compress!==undefined?e.compress:true;this.counter=r.counter||e.counter||0;this.agent=r.agent||e.agent}get method(){return this[y].method}get url(){return G(this[y].parsedURL)}get headers(){return this[y].headers}get redirect(){return this[y].redirect}get signal(){return this[y].signal}clone(){return new Request(this)}}Body.mixIn(Request.prototype);Object.defineProperty(Request.prototype,Symbol.toStringTag,{value:"Request",writable:false,enumerable:false,configurable:true});Object.defineProperties(Request.prototype,{method:{enumerable:true},url:{enumerable:true},headers:{enumerable:true},redirect:{enumerable:true},clone:{enumerable:true},signal:{enumerable:true}});function getNodeRequestOptions(e){const r=e[y].parsedURL;const t=new Headers(e[y].headers);if(!t.has("Accept")){t.set("Accept","*/*")}if(!r.protocol||!r.hostname){throw new TypeError("Only absolute URLs are supported")}if(!/^https?:$/.test(r.protocol)){throw new TypeError("Only HTTP(S) protocols are supported")}if(e.signal&&e.body instanceof s.Readable&&!k){throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8")}let o=null;if(e.body==null&&/^(POST|PUT)$/i.test(e.method)){o="0"}if(e.body!=null){const r=getTotalBytes(e);if(typeof r==="number"){o=String(r)}}if(o){t.set("Content-Length",o)}if(!t.has("User-Agent")){t.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)")}if(e.compress&&!t.has("Accept-Encoding")){t.set("Accept-Encoding","gzip,deflate")}let n=e.agent;if(typeof n==="function"){n=n(r)}if(!t.has("Connection")&&!n){t.set("Connection","close")}return Object.assign({},r,{method:e.method,headers:exportNodeCompatibleHeaders(t),agent:n})}function AbortError(e){Error.call(this,e);this.type="aborted";this.message=e;Error.captureStackTrace(this,this.constructor)}AbortError.prototype=Object.create(Error.prototype);AbortError.prototype.constructor=AbortError;AbortError.prototype.name="AbortError";const O=s.PassThrough;const P=n.resolve;function fetch(e,r){if(!fetch.Promise){throw new Error("native promise missing, set fetch.Promise to your favorite alternative")}Body.Promise=fetch.Promise;return new fetch.Promise((function(t,n){const c=new Request(e,r);const u=getNodeRequestOptions(c);const p=(u.protocol==="https:"?i:o).request;const l=c.signal;let d=null;const m=function abort(){let e=new AbortError("The user aborted a request.");n(e);if(c.body&&c.body instanceof s.Readable){c.body.destroy(e)}if(!d||!d.body)return;d.body.emit("error",e)};if(l&&l.aborted){m();return}const g=function abortAndFinalize(){m();finalize()};const h=p(u);let T;if(l){l.addEventListener("abort",g)}function finalize(){h.abort();if(l)l.removeEventListener("abort",g);clearTimeout(T)}if(c.timeout){h.once("socket",(function(e){T=setTimeout((function(){n(new FetchError(`network timeout at: ${c.url}`,"request-timeout"));finalize()}),c.timeout)}))}h.on("error",(function(e){n(new FetchError(`request to ${c.url} failed, reason: ${e.message}`,"system",e));finalize()}));h.on("response",(function(e){clearTimeout(T);const r=createHeadersLenient(e.headers);if(fetch.isRedirect(e.statusCode)){const s=r.get("Location");const o=s===null?null:P(c.url,s);switch(c.redirect){case"error":n(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${c.url}`,"no-redirect"));finalize();return;case"manual":if(o!==null){try{r.set("Location",o)}catch(e){n(e)}}break;case"follow":if(o===null){break}if(c.counter>=c.follow){n(new FetchError(`maximum redirect reached at: ${c.url}`,"max-redirect"));finalize();return}const s={headers:new Headers(c.headers),follow:c.follow,counter:c.counter+1,agent:c.agent,compress:c.compress,method:c.method,body:c.body,signal:c.signal,timeout:c.timeout,size:c.size};if(e.statusCode!==303&&c.body&&getTotalBytes(c)===null){n(new FetchError("Cannot follow redirect with body being a readable stream","unsupported-redirect"));finalize();return}if(e.statusCode===303||(e.statusCode===301||e.statusCode===302)&&c.method==="POST"){s.method="GET";s.body=undefined;s.headers.delete("content-length")}t(fetch(new Request(o,s)));finalize();return}}e.once("end",(function(){if(l)l.removeEventListener("abort",g)}));let s=e.pipe(new O);const o={url:c.url,status:e.statusCode,statusText:e.statusMessage,headers:r,size:c.size,timeout:c.timeout,counter:c.counter};const i=r.get("Content-Encoding");if(!c.compress||c.method==="HEAD"||i===null||e.statusCode===204||e.statusCode===304){d=new Response(s,o);t(d);return}const u={flush:a.Z_SYNC_FLUSH,finishFlush:a.Z_SYNC_FLUSH};if(i=="gzip"||i=="x-gzip"){s=s.pipe(a.createGunzip(u));d=new Response(s,o);t(d);return}if(i=="deflate"||i=="x-deflate"){const r=e.pipe(new O);r.once("data",(function(e){if((e[0]&15)===8){s=s.pipe(a.createInflate())}else{s=s.pipe(a.createInflateRaw())}d=new Response(s,o);t(d)}));return}if(i=="br"&&typeof a.createBrotliDecompress==="function"){s=s.pipe(a.createBrotliDecompress());d=new Response(s,o);t(d);return}d=new Response(s,o);t(d)}));writeToStream(h,c)}))}fetch.isRedirect=function(e){return e===301||e===302||e===303||e===307||e===308};fetch.Promise=global.Promise;e.exports=r=fetch;Object.defineProperty(r,"__esModule",{value:true});r.default=r;r.Headers=Headers;r.Request=Request;r.Response=Response;r.FetchError=FetchError},352:(e,r,t)=>{var s=t(212);e.exports=s(once);e.exports.strict=s(onceStrict);once.proto=once((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:true});Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:true})}));function once(e){var f=function(){if(f.called)return f.value;f.called=true;return f.value=e.apply(this,arguments)};f.called=false;return f}function onceStrict(e){var f=function(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=e.apply(this,arguments)};var r=e.name||"Function wrapped with `once`";f.onceError=r+" shouldn't be called more than once";f.called=false;return f}},494:(e,r,t)=>{e.exports=t(955)},955:(e,r,t)=>{"use strict";var s=t(631);var o=t(16);var n=t(605);var i=t(211);var a=t(614);var c=t(357);var u=t(669);r.httpOverHttp=httpOverHttp;r.httpsOverHttp=httpsOverHttp;r.httpOverHttps=httpOverHttps;r.httpsOverHttps=httpsOverHttps;function httpOverHttp(e){var r=new TunnelingAgent(e);r.request=n.request;return r}function httpsOverHttp(e){var r=new TunnelingAgent(e);r.request=n.request;r.createSocket=createSecureSocket;r.defaultPort=443;return r}function httpOverHttps(e){var r=new TunnelingAgent(e);r.request=i.request;return r}function httpsOverHttps(e){var r=new TunnelingAgent(e);r.request=i.request;r.createSocket=createSecureSocket;r.defaultPort=443;return r}function TunnelingAgent(e){var r=this;r.options=e||{};r.proxyOptions=r.options.proxy||{};r.maxSockets=r.options.maxSockets||n.Agent.defaultMaxSockets;r.requests=[];r.sockets=[];r.on("free",(function onFree(e,t,s,o){var n=toOptions(t,s,o);for(var i=0,a=r.requests.length;i=this.maxSockets){o.requests.push(n);return}o.createSocket(n,(function(r){r.on("free",onFree);r.on("close",onCloseOrRemove);r.on("agentRemove",onCloseOrRemove);e.onSocket(r);function onFree(){o.emit("free",r,n)}function onCloseOrRemove(e){o.removeSocket(r);r.removeListener("free",onFree);r.removeListener("close",onCloseOrRemove);r.removeListener("agentRemove",onCloseOrRemove)}}))};TunnelingAgent.prototype.createSocket=function createSocket(e,r){var t=this;var s={};t.sockets.push(s);var o=mergeOptions({},t.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:false,headers:{host:e.host+":"+e.port}});if(e.localAddress){o.localAddress=e.localAddress}if(o.proxyAuth){o.headers=o.headers||{};o.headers["Proxy-Authorization"]="Basic "+new Buffer(o.proxyAuth).toString("base64")}p("making CONNECT request");var n=t.request(o);n.useChunkedEncodingByDefault=false;n.once("response",onResponse);n.once("upgrade",onUpgrade);n.once("connect",onConnect);n.once("error",onError);n.end();function onResponse(e){e.upgrade=true}function onUpgrade(e,r,t){process.nextTick((function(){onConnect(e,r,t)}))}function onConnect(o,i,a){n.removeAllListeners();i.removeAllListeners();if(o.statusCode!==200){p("tunneling socket could not be established, statusCode=%d",o.statusCode);i.destroy();var c=new Error("tunneling socket could not be established, "+"statusCode="+o.statusCode);c.code="ECONNRESET";e.request.emit("error",c);t.removeSocket(s);return}if(a.length>0){p("got illegal response body from proxy");i.destroy();var c=new Error("got illegal response body from proxy");c.code="ECONNRESET";e.request.emit("error",c);t.removeSocket(s);return}p("tunneling connection has established");t.sockets[t.sockets.indexOf(s)]=i;return r(i)}function onError(r){n.removeAllListeners();p("tunneling socket could not be established, cause=%s\n",r.message,r.stack);var o=new Error("tunneling socket could not be established, "+"cause="+r.message);o.code="ECONNRESET";e.request.emit("error",o);t.removeSocket(s)}};TunnelingAgent.prototype.removeSocket=function removeSocket(e){var r=this.sockets.indexOf(e);if(r===-1){return}this.sockets.splice(r,1);var t=this.requests.shift();if(t){this.createSocket(t,(function(e){t.request.onSocket(e)}))}};function createSecureSocket(e,r){var t=this;TunnelingAgent.prototype.createSocket.call(t,e,(function(s){var n=e.request.getHeader("host");var i=mergeOptions({},t.options,{socket:s,servername:n?n.replace(/:.*$/,""):e.host});var a=o.connect(0,i);t.sockets[t.sockets.indexOf(s)]=a;r(a)}))}function toOptions(e,r,t){if(typeof e==="string"){return{host:e,port:r,localAddress:t}}return e}function mergeOptions(e){for(var r=1,t=arguments.length;r{"use strict";Object.defineProperty(r,"__esModule",{value:true});function getUserAgent(){if(typeof navigator==="object"&&"userAgent"in navigator){return navigator.userAgent}if(typeof process==="object"&&"version"in process){return`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`}return""}r.getUserAgent=getUserAgent},212:e=>{e.exports=wrappy;function wrappy(e,r){if(e&&r)return wrappy(e)(r);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach((function(r){wrapper[r]=e[r]}));return wrapper;function wrapper(){var r=new Array(arguments.length);for(var t=0;t{module.exports=eval("require")("encoding")},357:e=>{"use strict";e.exports=require("assert")},614:e=>{"use strict";e.exports=require("events")},747:e=>{"use strict";e.exports=require("fs")},605:e=>{"use strict";e.exports=require("http")},211:e=>{"use strict";e.exports=require("https")},631:e=>{"use strict";e.exports=require("net")},87:e=>{"use strict";e.exports=require("os")},622:e=>{"use strict";e.exports=require("path")},413:e=>{"use strict";e.exports=require("stream")},16:e=>{"use strict";e.exports=require("tls")},835:e=>{"use strict";e.exports=require("url")},669:e=>{"use strict";e.exports=require("util")},761:e=>{"use strict";e.exports=require("zlib")}};var __webpack_module_cache__={};function __nccwpck_require__(e){var r=__webpack_module_cache__[e];if(r!==undefined){return r.exports}var t=__webpack_module_cache__[e]={exports:{}};var s=true;try{__webpack_modules__[e].call(t.exports,t,t.exports,__nccwpck_require__);s=false}finally{if(s)delete __webpack_module_cache__[e]}return t.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__={};(()=>{const e=__nccwpck_require__(21);const r=__nccwpck_require__(366);const t=__nccwpck_require__(32);(async function(){const s=["highest","high","normal","low","lowest"];const o=["verbose","info","notice","warning","error","success"];function isEmpty(e){return!e||e.length===0}try{const n=e.getInput("token",{required:true});let i=e.getInput("title");let a=e.getInput("text");let c=e.getInput("priority");let u=e.getInput("level");const p={verbose:"lowest",info:"low",notice:"lowest",success:"normal",warning:"high",error:"highest"};for(const[r,t]of Object.entries(p)){const s=e.getInput(r);if(isEmpty(s)){continue}a=s;if(isEmpty(c)){c=t}if(isEmpty(u)){u=r}break}if(isEmpty(i)){i=r.context.repo.owner+"/"+r.context.repo.repo}if(isEmpty(c)){c="normal"}if(isEmpty(u)){u="info"}if(isEmpty(a)){e.setFailed("Text can't be empty");return}if(s.indexOf(c)===-1){e.setFailed("Invalid priority value: "+c);return}if(o.indexOf(u)===-1){e.setFailed("Invalid level value: "+u);return}const l={title:i,text:a,priority:c,level:u};const d="https://notify.events/api/v1/channel/source/"+n+"/execute";const m=await t(d,{method:"post",body:JSON.stringify(l),headers:{"Content-Type":"application/json"}});if(!m.ok){e.setFailed("["+m.status+"] "+m.statusText)}}catch(r){e.setFailed(r.message)}})()})();module.exports=__webpack_exports__})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..19f7fd7 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,170 @@ +{ + "name": "github-action", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@actions/core": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.4.0.tgz", + "integrity": "sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg==" + }, + "@actions/github": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.0.tgz", + "integrity": "sha512-QvE9eAAfEsS+yOOk0cylLBIO/d6WyWIOvsxxzdrPFaud39G6BOkUwScXZn1iBzQzHyu9SBkkLSWlohDWdsasAQ==", + "requires": { + "@actions/http-client": "^1.0.11", + "@octokit/core": "^3.4.0", + "@octokit/plugin-paginate-rest": "^2.13.3", + "@octokit/plugin-rest-endpoint-methods": "^5.1.1" + } + }, + "@actions/http-client": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", + "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", + "requires": { + "tunnel": "0.0.6" + } + }, + "@octokit/auth-token": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", + "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==", + "requires": { + "@octokit/types": "^6.0.3" + } + }, + "@octokit/core": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.5.1.tgz", + "integrity": "sha512-omncwpLVxMP+GLpLPgeGJBF6IWJFjXDS5flY5VbppePYX9XehevbDykRH9PdCdvqt9TS5AOTiDide7h0qrkHjw==", + "requires": { + "@octokit/auth-token": "^2.4.4", + "@octokit/graphql": "^4.5.8", + "@octokit/request": "^5.6.0", + "@octokit/request-error": "^2.0.5", + "@octokit/types": "^6.0.3", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/endpoint": { + "version": "6.0.12", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz", + "integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==", + "requires": { + "@octokit/types": "^6.0.3", + "is-plain-object": "^5.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/graphql": { + "version": "4.6.4", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.4.tgz", + "integrity": "sha512-SWTdXsVheRmlotWNjKzPOb6Js6tjSqA2a8z9+glDJng0Aqjzti8MEWOtuT8ZSu6wHnci7LZNuarE87+WJBG4vg==", + "requires": { + "@octokit/request": "^5.6.0", + "@octokit/types": "^6.0.3", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/openapi-types": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-9.4.0.tgz", + "integrity": "sha512-rKRkXikOJgDNImPl49IJuECLVXjj+t4qOXHhl8SBjMQCGGp1w4m5Ud/0kfdUx+zCpTvBN8vaOUDF4nnboZoOtQ==" + }, + "@octokit/plugin-paginate-rest": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.15.0.tgz", + "integrity": "sha512-/vjcb0w6ggVRtsb8OJBcRR9oEm+fpdo8RJk45khaWw/W0c8rlB2TLCLyZt/knmC17NkX7T9XdyQeEY7OHLSV1g==", + "requires": { + "@octokit/types": "^6.23.0" + } + }, + "@octokit/plugin-rest-endpoint-methods": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.7.0.tgz", + "integrity": "sha512-G7sgccWRYQMwcHJXkDY/sDxbXeKiZkFQqUtzBCwmrzCNj2GQf3VygQ4T/BFL2crLVpIbenkE/c0ErhYOte2MPw==", + "requires": { + "@octokit/types": "^6.24.0", + "deprecation": "^2.3.1" + } + }, + "@octokit/request": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.0.tgz", + "integrity": "sha512-4cPp/N+NqmaGQwbh3vUsYqokQIzt7VjsgTYVXiwpUP2pxd5YiZB2XuTedbb0SPtv9XS7nzAKjAuQxmY8/aZkiA==", + "requires": { + "@octokit/endpoint": "^6.0.1", + "@octokit/request-error": "^2.1.0", + "@octokit/types": "^6.16.1", + "is-plain-object": "^5.0.0", + "node-fetch": "^2.6.1", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/request-error": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", + "integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==", + "requires": { + "@octokit/types": "^6.0.3", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "@octokit/types": { + "version": "6.24.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.24.0.tgz", + "integrity": "sha512-MfEimJeQ8AV1T2nI5kOfHqsqPHaAnG0Dw3MVoHSEsEq6iLKx2N91o+k2uAgXhPYeSE76LVBqjgTShnFFgNwe0A==", + "requires": { + "@octokit/openapi-types": "^9.4.0" + } + }, + "before-after-hook": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz", + "integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==" + }, + "deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" + }, + "universal-user-agent": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..9f1b2ae --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "github-action", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "build": "ncc build -m src/index.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/notify-events/github-action.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/notify-events/github-action/issues" + }, + "homepage": "https://github.com/notify-events/github-action#readme", + "dependencies": { + "@actions/core": "^1.4.0", + "@actions/github": "^5.0.0", + "node-fetch": "^2.6.1" + } +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..189b6c5 --- /dev/null +++ b/src/index.js @@ -0,0 +1,100 @@ +const core = require('@actions/core'); +const github = require('@actions/github'); +const fetch = require('node-fetch'); + +(async function () { + const priorities = ['highest', 'high', 'normal', 'low', 'lowest']; + const levels = ['verbose', 'info', 'notice', 'warning', 'error', 'success']; + + function isEmpty(value) { + return !value || (value.length === 0); + } + + try { + const token = core.getInput('token', { required: true }); + + let title = core.getInput('title'); + let text = core.getInput('text'); + let priority = core.getInput('priority'); + let level = core.getInput('level'); + + const map = { + verbose: 'lowest', + info: 'low', + notice: 'lowest', + success: 'normal', + warning: 'high', + error: 'highest', + }; + + for (const [l, p] of Object.entries(map)) { + const t = core.getInput(l); + + if (isEmpty(t)) { + continue; + } + + text = t; + + if (isEmpty(priority)) { + priority = p; + } + + if (isEmpty(level)) { + level = l; + } + + break; + } + + if (isEmpty(title)) { + title = github.context.repo.owner + '/' + github.context.repo.repo; + } + + if (isEmpty(priority)) { + priority = 'normal'; + } + + if (isEmpty(level)) { + level = 'info'; + } + + if (isEmpty(text)) { + core.setFailed('Text can\'t be empty'); + return; + } + + if (priorities.indexOf(priority) === -1) { + core.setFailed('Invalid priority value: ' + priority); + return; + } + + if (levels.indexOf(level) === -1) { + core.setFailed('Invalid level value: ' + level); + return; + } + + const body = { + title: title, + text: text, + priority: priority, + level: level + }; + + const url = 'https://notify.events/api/v1/channel/source/' + token + '/execute'; + + const response = await fetch(url, { + method: 'post', + body: JSON.stringify(body), + headers: { + 'Content-Type': 'application/json' + } + }); + + if (!response.ok) { + core.setFailed('[' + response.status + '] ' + response.statusText) + } + } catch (error) { + core.setFailed(error.message); + } +})();