scan.lighthouse #199
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: scan.lighthouse | |
on: | |
workflow_dispatch: | |
push: | |
branches: [$default-branch, gh-pages] | |
pull_request: | |
branches: [$default-branch, gh-pages] | |
types: [opened,assigned,synchronize] | |
schedule: | |
- cron: '0 10 * * 2' | |
env: | |
ENDPOIND: https://ivankatliarchuk.github.io/knowledge-base | |
TEMPLATE: .github/templates/issue.lighthouse.md | |
jobs: | |
lighthouse: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.5 | |
with: | |
fetch-depth: 1 | |
- name: run lighthouse | |
uses: foo-software/lighthouse-check-action@master | |
id: lighthouseCheck | |
with: | |
accessToken: ${{ secrets.GITHUB_TOKEN }} | |
tag: GitHub Action | |
urls: ${{ env.ENDPOIND }} | |
sha: ${{ github.sha }} | |
branch: ${{ github.ref }} | |
author: ${{ github.actor }} | |
prCommentEnabled: true | |
prCommentSaveOld: true | |
outputDirectory: "_help" | |
# - name: Upload artifacts | |
# uses: actions/upload-artifact@master | |
# with: | |
# name: Lighthouse reports | |
# path: _help | |
- name: handle lighthouse check results | |
uses: foo-software/lighthouse-check-status-action@master | |
id: status | |
with: | |
lighthouseCheckResults: ${{ steps.lighthouseCheck.outputs.lighthouseCheckResults }} | |
minAccessibilityScore: "90" | |
minBestPracticesScore: "50" | |
minPerformanceScore: "50" | |
minProgressiveWebAppScore: "50" | |
minSeoScore: "50" | |
- name: results | |
id: results | |
run: | | |
echo "::set-output name=accessibility::$(cat _help/results.json | jq '.[] | .scores.accessibility')" | |
echo "::set-output name=bestPractices::$(cat _help/results.json | jq '.[] | .scores.bestPractices')" | |
echo "::set-output name=performance::$(cat _help/results.json | jq '.[] | .scores.performance')" | |
echo "::set-output name=progressiveWebApp::$(cat _help/results.json | jq '.[] | .scores.progressiveWebApp')" | |
echo "::set-output name=seo::$(cat _help/results.json | jq '.[] | .scores.seo')" | |
# https://github.com/JasonEtco/actions-toolkit#toolscontext | |
- name: create issue from file | |
uses: JasonEtco/create-an-issue@v2.9.2 | |
id: create-issue | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ACCESSIBILITY: ${{ steps.results.outputs.accessibility }} | |
BEST_PRACTICES: ${{ steps.results.outputs.bestPractices }} | |
PERFORMANCE: ${{ steps.results.outputs.performance }} | |
PROGRESSIVE_WEBAPP: ${{ steps.results.outputs.progressiveWebApp }} | |
SEO: ${{ steps.results.outputs.seo }} | |
TITLE: 'Lighthosue performance' | |
with: | |
filename: ${{ env.TEMPLATE }} | |
assignees: ${{ github.repository_owner }} | |
update_existing: true | |
- run: 'echo Created issue number ${{ steps.create-issue.outputs.number }}' | |
- run: 'echo Created ${{ steps.create-issue.outputs.url }}' |