Skip to content

Add option to preserve file attributes #516

Add option to preserve file attributes

Add option to preserve file attributes #516

Workflow file for this run

name: Calculate test coverage (on manual retry only)
on:
pull_request:
branches: [ main ]
jobs:
coverage:
runs-on: ubuntu-latest
if: github.run_attempt > 1
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: '1.21'
- name: Generate coverage comment
id: gen_report
run: |
make test_coverage_html
make test_coverage > report.txt
content="$(cat report.txt)"
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=content::$content"
- name: Upload preview report to action run
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: test-coverage
path: coverage.html
- name: Write test coverage into PR comment
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `[Test coverage report generated](https://github.com/hashicorp/go-extract/actions/runs/${{ github.run_id }}) ✍
\`\`\`
${process.env.CONTENT}
\`\`\``
})
env:
CONTENT: "${{ steps.gen_report.outputs.content }}"