diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9b1619c..3bf2cd0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Run local action +name: Run branch action on: workflow_dispatch: @@ -7,6 +7,10 @@ on: description: runner required: true default: ubuntu-latest + version: + description: version + required: false + default: latest working_directory: description: working_directory required: false @@ -60,7 +64,7 @@ jobs: id: dd with: working_directory: ${{ github.event.inputs.working_directory }} - command: ${{ github.event.inputs.command }} + version: ${{ github.event.inputs.version }} config: ${{ github.event.inputs.config }} input: ${{ github.event.inputs.input }} create_pr_on_change: ${{ github.event.inputs.create_pr_on_change }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0608e7c..3284aa6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: id: dd with: config: ./artifacts/.doc-detective.json - input: doc-content-inline-tests.md + input: ./artifacts/doc-content-inline-tests.md fail-tests: runs-on: ${{ matrix.os }} @@ -42,5 +42,5 @@ jobs: continue-on-error: true with: config: ./artifacts/.doc-detective.json - input: doc-content-inline-tests-fail.md + input: ./artifacts/doc-content-inline-tests-fail.md exit_on_fail: true diff --git a/dist/index.js b/dist/index.js index e139fbb..6831655 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1882,6 +1882,7 @@ class Context { this.action = process.env.GITHUB_ACTION; this.actor = process.env.GITHUB_ACTOR; this.job = process.env.GITHUB_JOB; + this.runAttempt = parseInt(process.env.GITHUB_RUN_ATTEMPT, 10); this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10); this.runId = parseInt(process.env.GITHUB_RUN_ID, 10); this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`; @@ -31841,13 +31842,18 @@ async function main() { } // Get the inputs const version = core.getInput("version"); - const dd = version ? `doc-detective@${version}` : "doc-detective"; + const dd = `doc-detective@${version}`; const cwd = core.getInput("working_directory"); const config = core.getInput("config"); const input = core.getInput("input"); // Compile command let compiledCommand = `npx ${dd}`; + // If v2, add the 'runTests' command + if (version.startsWith("2")) { + compiledCommand += " runTests"; + } + // Add the options if (config) compiledCommand += ` --config ${config}`; if (input) compiledCommand += ` --input ${input}`; const outputPath = path.resolve( diff --git a/index.js b/index.js index 785d430..a712f78 100644 --- a/index.js +++ b/index.js @@ -32,6 +32,11 @@ async function main() { // Compile command let compiledCommand = `npx ${dd}`; + // If v2, add the 'runTests' command + if (version.startsWith("2")) { + compiledCommand += " runTests"; + } + // Add the options if (config) compiledCommand += ` --config ${config}`; if (input) compiledCommand += ` --input ${input}`; const outputPath = path.resolve( diff --git a/package-lock.json b/package-lock.json index 73b2a35..93a9fe6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "doc-detective-github-action", - "version": "1.3.0", + "version": "1.3.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "doc-detective-github-action", - "version": "1.3.0", + "version": "1.3.1", "license": "AGPL-3.0-only", "dependencies": { "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", - "@actions/github": "^6.0.0" + "@actions/github": "^6.0.1" }, "devDependencies": { "@vercel/ncc": "^0.38.3", @@ -36,14 +36,18 @@ } }, "node_modules/@actions/github": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", - "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.1.tgz", + "integrity": "sha512-xbZVcaqD4XnQAe35qSQqskb3SqIAfRyLBrHMd/8TuL7hJSz2QtbDwnNM8zWx4zO5l2fnGtseNE3MbEvD7BxVMw==", + "license": "MIT", "dependencies": { "@actions/http-client": "^2.2.0", "@octokit/core": "^5.0.1", - "@octokit/plugin-paginate-rest": "^9.0.0", - "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + "@octokit/plugin-paginate-rest": "^9.2.2", + "@octokit/plugin-rest-endpoint-methods": "^10.4.0", + "@octokit/request": "^8.4.1", + "@octokit/request-error": "^5.1.1", + "undici": "^5.28.5" } }, "node_modules/@actions/http-client": { diff --git a/package.json b/package.json index 6f4d065..8846934 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "doc-detective-github-action", - "version": "1.3.0", + "version": "1.3.1", "description": "Validate doc content by treating docs as testable assertions for a product.", "main": "index.js", "scripts": { @@ -22,7 +22,7 @@ "dependencies": { "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", - "@actions/github": "^6.0.0" + "@actions/github": "^6.0.1" }, "devDependencies": { "@vercel/ncc": "^0.38.3",