From 030b8801aedcd74af24e352a6da41c7867edd209 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Fri, 17 Nov 2023 14:49:54 -0600 Subject: [PATCH] added preliminary check --- .github/workflows/auto-pr-ontobot.yml | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-pr-ontobot.yml b/.github/workflows/auto-pr-ontobot.yml index a868732955..41a81be3dc 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: @@ -55,8 +78,7 @@ jobs: ochange process-issue ${{ env.resource }} \ -r ${{ steps.gh-script-repo.outputs.result }} \ -n ${{ steps.gh-script-issue.outputs.result }} \ - -g ${{ secrets.GH_TOKEN }} \ - -p UBERON + -g ${{ secrets.GH_TOKEN }} - name: Create Pull Request uses: peter-evans/create-pull-request@v4 @@ -70,4 +92,4 @@ jobs: committer: ${{ env.ISSUE_CREATOR }} <${{ env.ISSUE_CREATOR }}@users.noreply.github.com> base: ${{ github.head_ref }} branch: ${{ env.branch-name }} - # token: ${{ secrets.GH_TOKEN }} + # token: ${{ secrets.GH_TOKEN }} \ No newline at end of file