From db81618f92ff9294ba4fd5fd85011453f401e342 Mon Sep 17 00:00:00 2001 From: Matt O'Keefe Date: Thu, 28 Dec 2023 11:51:58 -0600 Subject: [PATCH] update workflow files --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/pr-title.yml | 1 + .github/workflows/publish.yml | 4 +-- .github/workflows/test.yml | 8 +++--- src/messageHandlers/plusplus.js | 36 ++++++++++++++++----------- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 08c2ac2..c398f01 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/setup-node@v4 with: fetch-depth: 2 diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 41696f5..a1a6e58 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -16,6 +16,7 @@ jobs: main: name: Semantic PR runs-on: ubuntu-latest + if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot') steps: - uses: amannn/action-semantic-pull-request@v5.4.0 id: lint_pr_title diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f3881ba..a48ed5d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,8 +10,8 @@ jobs: name: Publish to npm runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: 18 registry-url: https://registry.npmjs.org/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 76b08c4..ce1dce2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -on: +on: push: branches: [main] pull_request: @@ -19,12 +19,12 @@ jobs: os: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/setup-node@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - + - name: npm install, build, and test run: | npm install diff --git a/src/messageHandlers/plusplus.js b/src/messageHandlers/plusplus.js index 36a9fc2..0e94ff1 100644 --- a/src/messageHandlers/plusplus.js +++ b/src/messageHandlers/plusplus.js @@ -106,20 +106,24 @@ module.exports = function plusplus(robot) { if (message) { msg.send(message); - robot.emit('plus-plus', { - notificationMessage: `<@${fromUser.slackId}> ${ - operator.match(RegExpPlusPlus.positiveOperators) ? 'sent' : 'removed' - } a ${Helpers.capitalizeFirstLetter(robot.name)} point ${ - operator.match(RegExpPlusPlus.positiveOperators) ? 'to' : 'from' - } <@${toUser.slackId}> in <#${room}>`, - sender: fromUser, - recipient: toUser, - direction: operator, - amount: 1, - room, - reason: cleanReason, - msg, - }); + robot.emit('plus-plus', [ + { + notificationMessage: `<@${fromUser.slackId}> ${ + operator.match(RegExpPlusPlus.positiveOperators) + ? 'sent' + : 'removed' + } a ${Helpers.capitalizeFirstLetter(robot.name)} point ${ + operator.match(RegExpPlusPlus.positiveOperators) ? 'to' : 'from' + } <@${toUser.slackId}> in <#${room}>`, + sender: fromUser, + recipient: toUser, + direction: operator, + amount: 1, + room, + reason: cleanReason, + msg, + }, + ]); } } @@ -186,6 +190,7 @@ module.exports = function plusplus(robot) { let messages = []; let fromUser; + const pointEmits = []; for (let i = 0; i < cleanNames.length; i++) { to[i].name = cleanNames[i]; let toUser; @@ -208,7 +213,7 @@ module.exports = function plusplus(robot) { messages.push( MessageFactory.BuildNewScoreMessage(toUser, cleanReason, robot), ); - robot.emit('plus-plus', { + pointEmits.push({ notificationMessage: `<@${fromUser.slackId}> ${ operator.match(RegExpPlusPlus.positiveOperators) ? 'sent' @@ -226,6 +231,7 @@ module.exports = function plusplus(robot) { }); } } + robot.emit('plus-plus', pointEmits); messages = messages.filter((message) => !!message); // de-dupe robot.logger.debug(`These are the messages \n ${messages.join('\n')}`);