diff --git a/README.md b/README.md index c9653cb..86ba1b4 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Check quality gate result from latest analysis and report result in the pull req | disable-pr-comment | Disable commenting result on the pull request | `false` | false | | fail-on-quality-gate-error | Set the action status to failed when quality gate status is `ERROR` | `false` | false | | branch | Branch name to retrieve the quality gate result | `false` | | -| pullRequest | Pull request id to retrieve the quality gate result | `false` | | +| pull-request | Pull request id to retrieve the quality gate result | `false` | | @@ -56,7 +56,7 @@ jobs: sonar-token: ${{ secrets.SONAR_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} branch: main # Optional input - pullRequest: 8 # Optional input + pull-request: 8 # Optional input - name: Output result run: | @@ -92,7 +92,7 @@ jobs: sonar-token: ${{ secrets.SONAR_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} branch: main # Optional input - pullRequest: 8 # Optional input + pull-request: 8 # Optional input - name: Output result run: | diff --git a/action.yml b/action.yml index 47bc798..d8551ea 100644 --- a/action.yml +++ b/action.yml @@ -24,7 +24,7 @@ inputs: branch: description: "Branch name to retrieve the quality gate result" required: false - pullRequest: + pull-request: description: "Pull request id to retrieve the quality gate result" required: false outputs: diff --git a/src/index.ts b/src/index.ts index e7e9132..a6c348a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,6 +16,7 @@ import { findComment } from "./modules/find-comment/main"; failOnQualityGateError: core.getInput("fail-on-quality-gate-error") === "true", branch: core.getInput("branch"), + pullRequest: core.getInput("pull-request"), githubToken: core.getInput("github-token"), }; @@ -23,7 +24,8 @@ import { findComment } from "./modules/find-comment/main"; inputs.hostURL, inputs.projectKey, inputs.token, - inputs.branch + inputs.branch, + inputs.pullRequest ); core.setOutput("project-status", result.projectStatus.status); diff --git a/src/modules/__tests__/sonarqube-api.test.ts b/src/modules/__tests__/sonarqube-api.test.ts index ce9203f..fcc473e 100644 --- a/src/modules/__tests__/sonarqube-api.test.ts +++ b/src/modules/__tests__/sonarqube-api.test.ts @@ -32,7 +32,7 @@ describe("fetchQualityGate", () => { ); }); - it("should make a GET request to the correct URL with `projectKey` and `pullRequest` parameter when `pullRequest` is defined", async () => { + it("should make a GET request to the correct URL with `projectKey` and `pullRequest` parameter when `pull-request` is defined", async () => { (axios.get as jest.Mock).mockResolvedValue({}); await fetchQualityGate( diff --git a/src/modules/models.ts b/src/modules/models.ts index e37686e..f2db81a 100644 --- a/src/modules/models.ts +++ b/src/modules/models.ts @@ -32,5 +32,6 @@ export interface ActionInputs { commentDisabled?: boolean; failOnQualityGateError?: boolean; branch?: string; + pullRequest?: string; githubToken?: string; }