Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/validate-pr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,10 @@ async function run() {
}
comment += `\nYou can validate ${table.length === 1 ? 'this' : 'these'} API${table.length === 1 ? '' : 's'} yourself by using the ${tick}make validate${tick} target.\n`

await octokit.rest.issues.createComment({
owner: 'elastic',
repo: 'elasticsearch-specification',
issue_number: context.payload.pull_request.number,
body: comment
})
core.setOutput('has_results', 'true')
core.setOutput('comment_body', comment)
} else {
core.setOutput('has_results', 'false')
}

core.info('Done!')
Expand Down
28 changes: 19 additions & 9 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,25 @@ jobs:
env:
GCS_CREDENTIALS: ${{ secrets.GCS_CREDENTIALS }}

- name: Remove previous comment
uses: maheshrayas/action-pr-comment-delete@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
org: elastic
repo: elasticsearch-specification
user: github-actions[bot]
issue: ${{ github.event.number }}

- name: Run validation
id: validation
working-directory: ./elasticsearch-specification
run: node .github/validate-pr --token ${{ secrets.GITHUB_TOKEN }}

- name: Find existing comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Following you can find the validation results'

- name: Create or update comment
if: steps.validation.outputs.has_results == 'true'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.validation.outputs.comment_body }}
edit-mode: replace
Loading