Skip to content

Commit

Permalink
Add a comment on coverage to PRs.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Mar 7, 2024
1 parent 21b3e2b commit f6ac05c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: API Coverage

on: [push, pull_request]
on: [push, pull_request_target]

env:
JAVA_VERSION: 11
OPENSEARCH_INITIAL_ADMIN_PASSWORD: BobgG7YrtsdKf9M

jobs:
coverage:
runs-on: ubuntu-latest
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Build and Run Docker Container
run: |
docker build coverage --tag opensearch-with-api-plugin
Expand All @@ -40,3 +42,14 @@ jobs:
total=`jq -r '.paths | keys | length' OpenSearch.auto.openapi.json`
percent=$((current * 100 / total))
echo "API specs implemented for $current/$total ($percent%) APIs."
cat >>"$GITHUB_OUTPUT" <<EOL
current=$current
total=$total
percent=$percent
EOL
- uses: peter-evans/create-or-update-comment@v4
if: github.event_name == 'pull_request_target'
with:
issue-number: ${{ github.event.number }}
body: |
API specs implemented for ${{ steps.coverage.outputs.current }}/${{ steps.coverage.outputs.total }} (${{ steps.coverage.outputs.percent }}%) APIs.

0 comments on commit f6ac05c

Please sign in to comment.