External PR #818
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: External PR | |
on: | |
workflow_run: | |
workflows: ["Java CI"] | |
types: | |
- completed | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | |
name: Comment | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: 'Download artifact' | |
uses: actions/[email protected] | |
with: | |
script: | | |
var artifacts = await github.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: ${{github.event.workflow_run.id }}, | |
}); | |
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | |
return artifact.name == "pr" | |
})[0]; | |
var download = await github.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: matchArtifact.id, | |
archive_format: 'zip', | |
}); | |
var fs = require('fs'); | |
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); | |
- run: unzip pr.zip | |
- name: outputs | |
run: |- | |
echo '::set-output name=PR::$(cat NR)' | |
echo '::set-output name=SHA::$(cat SHA)' | |
- name: cobertura-report-unit-test | |
uses: 5monkeys/cobertura-action@master | |
continue-on-error: true | |
with: | |
# The GITHUB_TOKEN for this repo | |
repo_token: ${{ github.token }} | |
# Path to the cobertura file. | |
path: jacoco-report/cobertura.xml | |
# If files with 100% should be skipped from report. | |
skip_covered: false | |
# Minimum allowed coverage percentage as an integer. | |
minimum_coverage: 65 | |
# Show line rate as specific column. | |
show_line: true | |
# Show branch rate as specific column. | |
show_branch: true | |
# Use class names instead of the filename | |
show_class_names: true | |
# Use a unique name for the report and comment | |
report_name: Unit Tests Coverage Report | |
pull_request_number: ${{ steps.outputs.outputs.PR }} | |
- name: cobertura-report-integration-test | |
uses: 5monkeys/cobertura-action@master | |
continue-on-error: true | |
with: | |
# The GITHUB_TOKEN for this repo | |
repo_token: ${{ github.token }} | |
# Path to the cobertura file. | |
path: jacoco-report/cobertura-it.xml | |
# If files with 100% should be skipped from report. | |
skip_covered: false | |
# Minimum allowed coverage percentage as an integer. | |
minimum_coverage: 58 | |
# Show line rate as specific column. | |
show_line: true | |
# Show branch rate as specific column. | |
show_branch: true | |
# Use class names instead of the filename | |
show_class_names: true | |
# Use a unique name for the report and comment | |
report_name: Integration Tests Coverage Report | |
pull_request_number: ${{ steps.outputs.outputs.PR }} |