From 53ebfe140c89720a8234b8ea4fabaf6de5736092 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 5 May 2020 08:02:35 +0000 Subject: [PATCH] feat: build for release --- README.md | 10 ++++++---- action.yml | 12 +++++++++--- entrypoint.sh | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ddea2de..6655474 100755 --- a/README.md +++ b/README.md @@ -22,15 +22,17 @@ jobs: steps: - uses: actions/checkout@master - name: Run codacy-coverage-reporter - uses: mrfyda/codacy-coverage-reporter-action@master + uses: codacy/codacy-coverage-reporter-action@master with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: cobertura.xml ``` ## Workflow options Change these options in the workflow `.yml` file to meet your GitHub project needs. -| Setting | Description | Default value | -| --------------- | ----------------------------------- | ------------------------------------- | -| `project-token` | The project API token | `${{ secrets.CODACY_PROJECT_TOKEN }}` | +| Setting | Description | Default value | +| ------------------ | ------------------------------------------------ | ------------------------------------- | +| `project-token` | The project API token | `${{ secrets.CODACY_PROJECT_TOKEN }}` | +| `coverage-reports` | Optional Comma separated list of reports to send | `''` | diff --git a/action.yml b/action.yml index aa87e53..06247e8 100755 --- a/action.yml +++ b/action.yml @@ -1,14 +1,20 @@ # action.yml -name: "codacy-coverage-reporter" -description: "Multi-language coverage reporter for Codacy" +name: 'Codacy Coverage Reporter' +description: 'Multi-language coverage reporter for Codacy' branding: icon: 'check' color: 'gray-dark' inputs: project-token: + description: 'Project token for the Codacy project you want to send coverage information' required: true + coverage-reports: + description: 'Optional comma separated list of coverage reports to send to Codacy' + required: false + default: '' runs: using: 'docker' image: 'Dockerfile' args: - - "${{ inputs.project-token }}" + - ${{ inputs.project-token }} + - ${{ inputs.coverage-reports }} diff --git a/entrypoint.sh b/entrypoint.sh index 3dcd1be..e9d72aa 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,19 @@ #!/bin/bash export CODACY_PROJECT_TOKEN=$1 -bash <(curl -Ls https://coverage.codacy.com/get.sh) +# comma separated list of report files +report_list=$2 + +IFS=',' +report_array=$report_list +params='' +for report in $report_array +do + if [ ! -z "$report" ] + then + params="$params -r $report" + fi +done + +bash <(curl -Ls https://coverage.codacy.com/get.sh) report $params --partial &&\ +bash <(curl -Ls https://coverage.codacy.com/get.sh) final