From e79793615f364250aeb81de8088059e90c80f946 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Wed, 4 Dec 2024 16:21:06 -0600 Subject: [PATCH 1/3] chore: debug statements for https://github.com/readmeio/rdme/pull/1082 --- bin/set-major-version-tag.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/set-major-version-tag.js b/bin/set-major-version-tag.js index ada20ac69..cbe4dd62e 100755 --- a/bin/set-major-version-tag.js +++ b/bin/set-major-version-tag.js @@ -37,6 +37,17 @@ async function runGitCmd(args) { */ async function setMajorVersionTag() { try { + console.log( + 'kanad test', + JSON.stringify({ + GITHUB_BASE_REF: process.env.GITHUB_BASE_REF, + GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF, + GITHUB_REF: process.env.GITHUB_REF, + GITHUB_REF_NAME: process.env.GITHUB_REF_NAME, + GITHUB_REF_TYPE: process.env.GITHUB_REF_TYPE, + }), + ); + const parsedVersion = parse(pkg.version); if (!parsedVersion) { From 4db0f583f02fe51d5e0a2e636483abc0f0df0acc Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Wed, 4 Dec 2024 16:21:51 -0600 Subject: [PATCH 2/3] chore: one more time, this time making sure i hit save --- bin/set-major-version-tag.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/set-major-version-tag.js b/bin/set-major-version-tag.js index cbe4dd62e..2b42e331c 100755 --- a/bin/set-major-version-tag.js +++ b/bin/set-major-version-tag.js @@ -44,7 +44,9 @@ async function setMajorVersionTag() { GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF, GITHUB_REF: process.env.GITHUB_REF, GITHUB_REF_NAME: process.env.GITHUB_REF_NAME, + GITHUB_REF_PROTECTED: process.env.GITHUB_REF_PROTECTED, GITHUB_REF_TYPE: process.env.GITHUB_REF_TYPE, + GITHUB_WORKFLOW_REF: process.env.GITHUB_WORKFLOW_REF, }), ); From 95cc2a90e5559ae793fb38d94879d863a12a2051 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Wed, 4 Dec 2024 17:24:37 -0600 Subject: [PATCH 3/3] ci: add test for validation failures (#1102) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🧰 Changes Adding a test so we can easily see errors when they're thrown in GitHub Actions. Also added a few related assertion steps. ## 🧬 QA & Testing Does the validation error show up properly? And do tests pass? --- .github/workflows/ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba7c9dfea..703c69ede 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,21 @@ jobs: with: rdme: openapi:validate "oas-examples-repo/3.1/json/petstore.json" + - name: Run `openapi:validate` on an invalid file + uses: ./rdme-repo/ + id: openapi-validate-fail + continue-on-error: true + with: + rdme: openapi:validate rdme-repo/__tests__/__fixtures__/invalid-oas.json + + - name: Assert that previous validation step failed + if: ${{ steps.openapi-validate-fail.outcome == 'failure' }} + run: echo "The validation in the previous step failed as expected." + + - name: Throw error if previous validation step did not fail + if: ${{ steps.openapi-validate-fail.outcome == 'success' }} + run: echo "::error::Expected validation in previous step to fail" && exit 1 + # Docs: https://rdme-test.readme.io - name: Run `openapi` command uses: ./rdme-repo/