From f6ec27bf99f782a6f9ccc3d682cea420d9f11fb5 Mon Sep 17 00:00:00 2001 From: Adam Rensel Date: Wed, 5 May 2021 15:43:19 -0400 Subject: [PATCH] Add actions event service to read the Actions data file --- .github/workflows/src/app/action-event.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/src/app/action-event.js diff --git a/.github/workflows/src/app/action-event.js b/.github/workflows/src/app/action-event.js new file mode 100644 index 00000000..62029bae --- /dev/null +++ b/.github/workflows/src/app/action-event.js @@ -0,0 +1,19 @@ +const fs = require('fs') + +class ActionsEvent { + constructor() { + try { + console.log("path: " + process.env.GITHUB_EVENT_PATH) + this.eventData = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8')) + // add the number back to the PR object + this.eventData.pull_request.number = this.eventData.number + this.pullRequest = this.eventData?.pull_request || {} + this.requestedReviwer = this.eventData?.requested_reviewer || {} + this.name = this.eventData?.action || "" + } catch(err) { + this.eventData = {} + } + } +} + +module.exports = new ActionsEvent() -- knotmirror 0.0.1