Skip to content

chore: integrate allure ci #1

chore: integrate allure ci

chore: integrate allure ci #1

name: Allure Test Reporter
on:
pull_request:
types:
- opened
- reopened
- synchronize
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
permissions:
id-token: write
contents: write # Required for gh-pages deployment
jobs:
test_and_publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- 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
- name: Load test report history
uses: actions/checkout@v4
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Generate Allure Report
uses: simple-elf/allure-report-action@master
if: always()
with:
gh_pages: gh-pages
allure_results: allure-results
allure_history: allure-history
keep_reports: 20
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: always()
with:
github_token: ${{ secrets.PAT }}
publish_branch: gh-pages
publish_dir: allure-history
- name: Add Test Report Link as Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PAT }}
script: |
const { owner, repo } = context.repo;
const prNumber = context.payload.pull_request.number;
const repoUrl = context.payload.repository.html_url;
const commentBody = `Allure Test reports for this run are available at:
- Allure Report: ${repoUrl}/pages/branch/gh-pages/index.html`;
// Comment on the pull request
await github.rest.issues.createComment({
owner,
repo,
issue_number: prNumber,
body: commentBody
});