|
11 | 11 | # check:
|
12 | 12 | # runs-on: ubuntu-latest
|
13 | 13 | # outputs:
|
14 |
| -# phraseExists: ${{ steps.check-body.outputs.result }} |
| 14 | +# phraseExists: ${{ steps.check-body.outputs.phraseExists }} |
15 | 15 | # commentId: ${{ steps.check-body.outputs.commentId }}
|
16 | 16 | # steps:
|
17 |
| -# - name: Check if issue body or any comment contains 'Hey ontobot' |
| 17 | +# - name: Check if issue body contains 'Hey ontobot' |
18 | 18 | # id: check-body
|
19 | 19 | # uses: actions/github-script@v6
|
20 | 20 | # with:
|
|
24 | 24 | # repo: context.repo.repo,
|
25 | 25 | # issue_number: context.issue.number
|
26 | 26 | # });
|
27 |
| - |
28 | 27 | # let bodyText = issue.data.body ? issue.data.body.toLowerCase() : '';
|
29 | 28 | # let commentId = null;
|
30 | 29 |
|
|
35 | 34 | # issue_number: context.issue.number
|
36 | 35 | # });
|
37 | 36 |
|
38 |
| -# // Check each comment for the phrase |
39 |
| -# for (const comment of comments.data) { |
40 |
| -# if (comment.body.toLowerCase().includes('hey ontobot')) { |
41 |
| -# bodyText += ' ' + comment.body.toLowerCase(); |
42 |
| -# commentId = comment.id; |
| 37 | +# // Function to check for the phrase in bodyText and comments |
| 38 | +# function checkForPhrase(bodyText, comments) { |
| 39 | +# const phrase = 'hey ontobot'; |
| 40 | + |
| 41 | +# // Check if bodyText includes the phrase |
| 42 | +# let result = bodyText.includes(phrase); |
| 43 | + |
| 44 | +# // If not found in bodyText, check each comment |
| 45 | +# if (!result) { |
| 46 | +# for (let comment of comments) { |
| 47 | +# if (comment.body.toLowerCase().includes(phrase)) { |
| 48 | +# result = true; |
| 49 | +# commentId = comment.id; |
| 50 | +# break; |
| 51 | +# } |
| 52 | +# } |
43 | 53 | # }
|
| 54 | + |
| 55 | +# return { |
| 56 | +# result: result, |
| 57 | +# commentId: result ? commentId : null |
| 58 | +# }; |
44 | 59 | # }
|
45 | 60 |
|
46 |
| -# return { |
47 |
| -# result: bodyText.includes('hey ontobot'), |
48 |
| -# commentId: commentId |
49 |
| -# }; |
| 61 | +# const checkResult = checkForPhrase(bodyText, comments.data); |
| 62 | + |
| 63 | +# console.log(`Result: ${checkResult.result}`); |
| 64 | +# console.log(`Comment ID: ${checkResult.commentId}`); |
| 65 | +# console.log(`Check Result: ${JSON.stringify(checkResult)}`); |
| 66 | + |
| 67 | +# core.setOutput('phraseExists', checkResult.result); |
| 68 | +# core.setOutput('commentId', checkResult.commentId); |
| 69 | + |
| 70 | +# - name: Log phraseExists output |
| 71 | +# run: | |
| 72 | +# echo "phraseExists: ${{ steps.check-body.outputs.phraseExists }}" |
| 73 | +# echo "commentId: ${{ steps.check-body.outputs.commentId }}" |
| 74 | +# echo "Outputs: $(echo '${{ toJSON(steps.check-body.outputs) }}')" |
| 75 | + |
| 76 | +# - name: Conditional step based on result |
| 77 | +# if: ${{ steps.check-body.outputs.phraseExists == 'true' }} |
| 78 | +# run: echo "The phrase 'Hey ontobot' was found." |
50 | 79 |
|
51 | 80 | # build:
|
52 | 81 | # needs: check
|
|
84 | 113 | # id: vars
|
85 | 114 | # run: |
|
86 | 115 | # echo "resource=src/ontology/mondo-edit.obo" >> $GITHUB_ENV
|
87 |
| -# echo "branch-name=ochange_automation_${{ steps.gh-script-issue.outputs.result }}" >> $GITHUB_ENV |
| 116 | +# echo "branch-name=ochange_automation_"${{ steps.gh-script-issue.outputs.result }} >> $GITHUB_ENV |
88 | 117 |
|
89 | 118 | # - name: Install dependencies
|
90 | 119 | # run: |
|
|
0 commit comments