From e059504658a148b5a51b86529574b8a496d56f58 Mon Sep 17 00:00:00 2001 From: Harshad Date: Wed, 6 Dec 2023 10:37:14 -0600 Subject: [PATCH] Preliminary check for ontobot workflow (#3121) * Preliminary check for ontobot workflow * Added missing line * Undo previous commit --- .github/workflows/auto-pr-ontobot.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/auto-pr-ontobot.yml b/.github/workflows/auto-pr-ontobot.yml index a868732955..d0664b9ea8 100644 --- a/.github/workflows/auto-pr-ontobot.yml +++ b/.github/workflows/auto-pr-ontobot.yml @@ -6,7 +6,30 @@ on: types: [ opened, edited ] jobs: + check: + runs-on: ubuntu-latest + outputs: + phraseExists: ${{ steps.check-body.outputs.result }} + steps: + - name: Check if issue body contains 'Hey ontobot' + id: check-body + uses: actions/github-script@v6 + with: + script: | + const issue = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number + }); + if (!issue.data.body) { + console.log('Issue body is empty or null'); + return false; + } + return issue.data.body.toLowerCase().includes('hey ontobot'); + build: + needs: check + if: needs.check.outputs.phraseExists == 'true' runs-on: ${{ matrix.os }} strategy: matrix: