Skip to content

Commit

Permalink
Check for the phrase Hey ontobot before running the workflow (#2228)
Browse files Browse the repository at this point in the history
* Uncommented crucial line

* Check for magic phrase before running the Workflow

* Address condition for empty body

* add token

* get issues syntx changed

* Optimized workflow

* test code

* reverted

* make it case insensitive
  • Loading branch information
hrshdhgd authored Nov 22, 2023
1 parent b6b3018 commit 90c8e5c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ontobot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
container: obolibrary/odkfull:v1.4.3
strategy:
Expand Down

0 comments on commit 90c8e5c

Please sign in to comment.