Skip to content

task/1940: resolve fileLocation in GCP triggered automations #1905

task/1940: resolve fileLocation in GCP triggered automations

task/1940: resolve fileLocation in GCP triggered automations #1905

Workflow file for this run

on: [pull_request]
name: Test coverage report # main.yml
permissions:
# allow dependabot to execute this workflow
pull-requests: write
jobs:
hello_world_job:
runs-on: ubuntu-latest
name: Test and report
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1000
- uses: actions/setup-node@v4
with:
node-version-file: ./package.json
- run: npm ci --ignore-scripts
- name: Run mcdev-tests with coverage
run: npm run coverage
- name: Prepare for Report Coverage
run: |
npx c8 report --reporter json-summary --exclude-after-remap false
npm i [email protected]
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1000
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
with:
name: test-coverage-output
path: coverage
- name: Download coverage artifact
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Get Run ID
id: get_run_id
run: |
echo "name=run_id::$(\
gh run list \
--workflow "${{ github.event.pull_request.base.ref == 'main' && 'coverage-main-branch.yml' || github.event.pull_request.base.ref == 'develop' && 'coverage-develop-branch.yml' || 'coverage.yml' }}" \
--json conclusion,headSha,status,databaseId \
--jq ".[] | select( .conclusion == \"success\" and .headSha == \"${{github.event.pull_request.base.sha}}\") | .databaseId" \
)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Download artifact for base branch if available, previous
uses: dawidd6/action-download-artifact@v6
continue-on-error: true
with:
workflow: ${{ github.event.pull_request.base.ref == 'main' && 'coverage-main-branch.yml' || github.event.pull_request.base.ref == 'develop' && 'coverage-develop-branch.yml' || 'coverage.yml' }}
run_id: ${{steps.get_run_id.outputs.run_id}}
name: 'test-coverage-output'
path: base-artifacts
search_artifacts: true
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v3
with:
files: 'base-artifacts/coverage-summary.json'
- name: Report coverage
uses: sidx1024/[email protected]
id: report
with:
coverage_file: 'artifacts/test-coverage-output/coverage-summary.json'
base_coverage_file: ${{steps.check_files.outputs.files_exists == 'true' && 'base-artifacts/coverage-summary.json' || ''}}
comment_template_file: '.coverage-comment-template.svelte'