From 8eac7d4c6da97ef80a92618693525c721fd04091 Mon Sep 17 00:00:00 2001 From: Akshay Iyyadurai Balasundaram Date: Fri, 20 Sep 2024 15:39:49 +0200 Subject: [PATCH] fix: bug fix + remove unwanted files --- .../notify-about-new-pr-via-slack.yml | 19 ------- dist/index.js | 50 +++++++++++++++++-- src/blockChainWebhook.ts | 29 ----------- src/setupClaCheck.ts | 8 +-- 4 files changed, 49 insertions(+), 57 deletions(-) delete mode 100644 .github/workflows/notify-about-new-pr-via-slack.yml delete mode 100644 src/blockChainWebhook.ts diff --git a/.github/workflows/notify-about-new-pr-via-slack.yml b/.github/workflows/notify-about-new-pr-via-slack.yml deleted file mode 100644 index 3e93f461..00000000 --- a/.github/workflows/notify-about-new-pr-via-slack.yml +++ /dev/null @@ -1,19 +0,0 @@ -# To get a Slack Webhook URL, follow instruction here: https://api.slack.com/messaging/webhooks - -name: "Notification regarding New Pull Request via Slack" -on: - pull_request_target: - types: [opened] -jobs: - notifyViaSlack: - runs-on: ubuntu-latest - steps: - - uses: denolib/setup-deno@v2 - with: - deno-version: v1.x - - run: | - echo ${{ github.event_name }} - echo ${{ github.event_path }} - deno run --allow-net https://deno.land/x/cicd/notify-via-slack.ts ${{ secrets.SLACK_WEBHOOK_URL }} ${{ github.repository }} "Pull Request Created - ${{ github.event.pull_request.html_url }}" - -# https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context diff --git a/dist/index.js b/dist/index.js index 54d57014..578a6f59 100644 --- a/dist/index.js +++ b/dist/index.js @@ -657,6 +657,7 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.commentContent = void 0; const input = __importStar(__nccwpck_require__(3611)); +const pr_sign_comment_1 = __nccwpck_require__(6718); function commentContent(signed, committerMap) { // using a `string` true or false purposely as github action input cannot have a boolean value if (input.getUseDcoFlag() == 'true') { @@ -715,7 +716,7 @@ function cla(signed, committerMap) { let lineOne = (input.getCustomNotSignedPrComment() || `
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that $you sign our [Contributor License Agreement](${input.getPathToDocument()}) before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.
`).replace('$you', you); let text = `${lineOne} - - - - ${input.getCustomPrSignComment() || "I have read the CLA Document and I hereby sign the CLA"} + ${(0, pr_sign_comment_1.getPrSignComment)()} - - - `; if (committersCount > 1 && committerMap && committerMap.signed && committerMap.notSigned) { @@ -930,13 +931,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.setupClaCheck = void 0; +const core = __importStar(__nccwpck_require__(2186)); +const github_1 = __nccwpck_require__(5438); const checkAllowList_1 = __nccwpck_require__(3661); const graphql_1 = __importDefault(__nccwpck_require__(5157)); -const pullRequestComment_1 = __importDefault(__nccwpck_require__(3326)); -const github_1 = __nccwpck_require__(5438); const persistence_1 = __nccwpck_require__(5802); +const pullRequestComment_1 = __importDefault(__nccwpck_require__(3326)); const pullRerunRunner_1 = __nccwpck_require__(4766); -const core = __importStar(__nccwpck_require__(2186)); function setupClaCheck() { return __awaiter(this, void 0, void 0, function* () { let committerMap = getInitialCommittersMap(); @@ -974,7 +975,7 @@ function getCLAFileContentandSHA(committers, committerMap) { result = yield (0, persistence_1.getFileContent)(); } catch (error) { - if (error.status === 404) { + if (error.status === "404") { return createClaFileAndPRComment(committers, committerMap); } else { @@ -1089,6 +1090,45 @@ const lockPullRequestAfterMerge = () => core.getInput('lock-pullrequest-aftermer exports.lockPullRequestAfterMerge = lockPullRequestAfterMerge; +/***/ }), + +/***/ 6718: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getPrSignComment = void 0; +const input = __importStar(__nccwpck_require__(3611)); +function getPrSignComment() { + return input.getCustomPrSignComment() || "I have read the CLA Document and I hereby sign the CLA"; +} +exports.getPrSignComment = getPrSignComment; + + /***/ }), /***/ 7351: diff --git a/src/blockChainWebhook.ts b/src/blockChainWebhook.ts deleted file mode 100644 index 2cb1af26..00000000 --- a/src/blockChainWebhook.ts +++ /dev/null @@ -1,29 +0,0 @@ -// import { CommittersDetails } from './interfaces' - -// import * as fetch from 'node-fetch' -// import * as core from '@actions/core' - -// export default async function blockChainWebhook(newSignedCommitters: CommittersDetails[]) { -// const blockchainURL = core.getInput('blockchain-webhook-endpoint') - -// try { -// const config = { -// method: 'POST', -// headers: { -// 'Accept': 'application/json', -// 'Content-Type': 'application/json', -// }, -// body: JSON.stringify(newSignedCommitters) -// } -// const res = await fetch(blockchainURL, config) -// const response = await res.json() -// if (response.success) { -// //return json -// return response -// } -// } catch (error) { -// core.setFailed('The webhook post request for storing signatures in smart contract failed' + error) -// } - - -// } \ No newline at end of file diff --git a/src/setupClaCheck.ts b/src/setupClaCheck.ts index dc47d920..eaf1c314 100644 --- a/src/setupClaCheck.ts +++ b/src/setupClaCheck.ts @@ -1,20 +1,20 @@ +import * as core from '@actions/core' +import { context } from '@actions/github' import { checkAllowList } from './checkAllowList' import getCommitters from './graphql' -import prCommentSetup from './pullrequest/pullRequestComment' import { ClafileContentAndSha, CommitterMap, CommittersDetails, ReactedCommitterMap } from './interfaces' -import { context } from '@actions/github' import { createFile, getFileContent, updateFile } from './persistence/persistence' +import prCommentSetup from './pullrequest/pullRequestComment' import { reRunLastWorkFlowIfRequired } from './pullRerunRunner' -import * as core from '@actions/core' export async function setupClaCheck() { let committerMap = getInitialCommittersMap() @@ -64,7 +64,7 @@ async function getCLAFileContentandSHA( try { result = await getFileContent() } catch (error) { - if (error.status === 404) { + if (error.status === "404") { return createClaFileAndPRComment(committers, committerMap) } else { throw new Error(