Skip to content

chore: update component test and generate reports #8

chore: update component test and generate reports

chore: update component test and generate reports #8

name: Component Test Reporter
on:
pull_request:
types:
- opened
- reopened
- synchronize
permissions:
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
contents: read # This is required for actions/checkout
jobs:
test_and_upload:
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_DEV_ACCOUNT_ID }}:role/${{ secrets.AWS_DEV_S3_SYNC_ROLE }}
aws-region: us-east-1
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
- name: Setup Node
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Run Tests and Generate Report
run: |
npm run test:ts -- component
- name: Uplaod Report to S3
run: |
aws s3 cp ./test_reports/ s3://test-integrations-dev/integrations-test-reports/${{ github.event.number }}/
- name: Comment on PR with S3 Object URL
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PAT }}
script: |
const { owner, repo } = context.repo;
// Get the pull request number
const prNumber = context.payload.pull_request.number;
const commentBody = `Test report for this run is available at: https://company.s3.amazonaws.com/integrations-test-reports/${prNumber}/test-report.html`;
// Comment on the pull request
await github.issues.createComment({ owner, repo, issue_number: prNumber, body: commentBody });