Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Add report list as parameter #14

Merged
merged 2 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ jobs:
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 | `''` |
12 changes: 9 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a real yaml list instead a comma separated string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't unfortunately. Github actions doesn't support it yet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required: false
default: ''
runs:
using: 'docker'
image: 'Dockerfile'
args:
- "${{ inputs.project-token }}"
- ${{ inputs.project-token }}
- ${{ inputs.coverage-reports }}
17 changes: 16 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 &&\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the &&\?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without it, we run the second action even if the first failed. Which shouldn't happen

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, cool 👍

bash <(curl -Ls https://coverage.codacy.com/get.sh) final