From 3343658ce8e589b69b687a5fd25e22010f66e78f Mon Sep 17 00:00:00 2001 From: dblock Date: Thu, 16 May 2024 13:23:33 -0400 Subject: [PATCH 1/3] Renamed workflows for consitency. Signed-off-by: dblock --- .../{coverage-gather.yml => coverage-api.yml} | 6 +++--- .github/workflows/coverage-comment.yml | 11 ++++++----- .github/workflows/{tools.yml => tests-tools.yml} | 4 ++-- DEVELOPER_GUIDE.md | 2 ++ coverage/README.md | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) rename .github/workflows/{coverage-gather.yml => coverage-api.yml} (95%) rename .github/workflows/{tools.yml => tests-tools.yml} (91%) diff --git a/.github/workflows/coverage-gather.yml b/.github/workflows/coverage-api.yml similarity index 95% rename from .github/workflows/coverage-gather.yml rename to .github/workflows/coverage-api.yml index 887132ebd..e40c9a373 100644 --- a/.github/workflows/coverage-gather.yml +++ b/.github/workflows/coverage-api.yml @@ -45,7 +45,7 @@ jobs: total=`jq -r '.paths | keys | length' build/local-openapi.json` percent=$((current * 100 / total)) echo "API specs implemented for $current/$total ($percent%) APIs." - cat >>"coverage.json" <>"coverage-api.json" < Date: Thu, 16 May 2024 13:34:21 -0400 Subject: [PATCH 2/3] Only add a comment if coverage has changed. Signed-off-by: dblock --- .github/workflows/coverage-api.yml | 1 + .github/workflows/coverage-comment.yml | 45 +++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coverage-api.yml b/.github/workflows/coverage-api.yml index e40c9a373..482e242bc 100644 --- a/.github/workflows/coverage-api.yml +++ b/.github/workflows/coverage-api.yml @@ -48,6 +48,7 @@ jobs: cat >>"coverage-api.json" < comment.body.startsWith("API specs implemented for ") + ); + + if (existing_comment && ! existing_comment.body.startsWith(body)) { + // change in coverage, delete existing comment + console.log(`Deleting ${existing_comment.url}.`); + await github.issues.deleteComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: coverage_api.pull_request, + comment_id: existing_comment.id + }); + } + + if (existing_comment && existing_comment.body.startsWith(body)) { + // no change in coverage, update commit id + await github.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: coverage_api.pull_request, + comment_id: existing_comment.id, + body: body + "\n" + commit + }); + } else { + // create a new comment + await github.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: coverage_api.pull_request, + body: body + "\n" + commit + }); + } \ No newline at end of file From 5f22dff0c76abc8938f6db9208f47bd3b1386d27 Mon Sep 17 00:00:00 2001 From: dblock Date: Thu, 16 May 2024 14:51:35 -0400 Subject: [PATCH 3/3] More renames for consistency. Signed-off-by: dblock --- .github/workflows/{links.yml => check-links.yml} | 4 ++-- .github/workflows/deploy.yml | 4 ++-- .github/workflows/{tests-tools.yml => test-tools.yml} | 2 +- .github/workflows/{lint.yml => validate-spec.yml} | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename .github/workflows/{links.yml => check-links.yml} (93%) rename .github/workflows/{tests-tools.yml => test-tools.yml} (96%) rename .github/workflows/{lint.yml => validate-spec.yml} (97%) diff --git a/.github/workflows/links.yml b/.github/workflows/check-links.yml similarity index 93% rename from .github/workflows/links.yml rename to .github/workflows/check-links.yml index bfdd4df3d..d4b521959 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/check-links.yml @@ -1,11 +1,11 @@ -name: Links +name: Check Links on: push: pull_request: jobs: - linkChecker: + check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c0ec9b73c..c180a53bd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,5 +1,5 @@ # deploys to https://opensearch-project.github.io/opensearch-api-specification/ -name: Deploy +name: Deploy to GitHub Pages on: push: @@ -14,7 +14,7 @@ permissions: contents: write jobs: - build: + deploy: runs-on: ubuntu-latest steps: - name: Checkout the repo diff --git a/.github/workflows/tests-tools.yml b/.github/workflows/test-tools.yml similarity index 96% rename from .github/workflows/tests-tools.yml rename to .github/workflows/test-tools.yml index 536ba13a2..81121b6bb 100644 --- a/.github/workflows/tests-tools.yml +++ b/.github/workflows/test-tools.yml @@ -11,7 +11,7 @@ on: - 'tools/**' jobs: - tests-tools: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/lint.yml b/.github/workflows/validate-spec.yml similarity index 97% rename from .github/workflows/lint.yml rename to .github/workflows/validate-spec.yml index 2d7bd2f26..5f26fec45 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/validate-spec.yml @@ -13,7 +13,7 @@ on: - 'tools/src/linter/**' jobs: - lint-spec: + validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3