mirror of
				https://github.com/bartvdbraak/omnidash.git
				synced 2025-10-31 00:19:12 +00:00 
			
		
		
		
	fix: Added Deploy Key
This commit is contained in:
		
							parent
							
								
									e7b1ffec56
								
							
						
					
					
						commit
						984b4e49f0
					
				
					 1 changed files with 57 additions and 2 deletions
				
			
		
							
								
								
									
										59
									
								
								.github/workflows/seo-reports.yaml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										59
									
								
								.github/workflows/seo-reports.yaml
									
										
									
									
										vendored
									
									
								
							|  | @ -14,10 +14,13 @@ concurrency: | ||||||
| 
 | 
 | ||||||
| jobs: | jobs: | ||||||
|   build-deploy: |   build-deploy: | ||||||
|     if: github.event.deployment_status.state == 'success' | 
 | ||||||
|  |     if: github.event.deployment_status.state == 'success'  && (github.event.deployment_status.environment == 'Production' || github.event.deployment_status.environment == 'Preview') | ||||||
|  | 
 | ||||||
|     environment: |     environment: | ||||||
|       name: github-pages |       name: github-pages | ||||||
|       url: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ steps.git-branch.outputs.SOURCE_REF }} |       url: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ steps.git-branch.outputs.SOURCE_REF }} | ||||||
|  | 
 | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     steps: |     steps: | ||||||
|       - name: Check out |       - name: Check out | ||||||
|  | @ -35,8 +38,11 @@ jobs: | ||||||
|         id: git-branch |         id: git-branch | ||||||
|         run: | |         run: | | ||||||
|            git fetch --all |            git fetch --all | ||||||
|  |            git branch -a --contains ${{ github.event.deployment.ref }} | ||||||
|            source_branches="$(git branch -a --contains ${{ github.event.deployment.ref }})" |            source_branches="$(git branch -a --contains ${{ github.event.deployment.ref }})" | ||||||
|            result=$(echo "$source_branches" | tail -n1 | sed 's/^[ \t]*//') |            result=$(echo "$source_branches" | tail -n1 | sed 's/^[ \t]*//') | ||||||
|  |            echo "Remote source of deployment: ${result}" | ||||||
|  |            echo "Local git ref of deployment: ${result#remotes/origin/*}" | ||||||
|            echo "SOURCE_REF=${result#remotes/origin/*}" >> "$GITHUB_OUTPUT" |            echo "SOURCE_REF=${result#remotes/origin/*}" >> "$GITHUB_OUTPUT" | ||||||
| 
 | 
 | ||||||
|       - name: Build Unlighthouse report |       - name: Build Unlighthouse report | ||||||
|  | @ -49,6 +55,55 @@ jobs: | ||||||
|       - name: Deploy |       - name: Deploy | ||||||
|         uses: peaceiris/actions-gh-pages@v3 |         uses: peaceiris/actions-gh-pages@v3 | ||||||
|         with: |         with: | ||||||
|           github_token: ${{ secrets.GH_PAGES_TOKEN }} |           deploy_key: ${{ secrets.GH_PAGES_DEPLOY_PRIVATE_KEY }} | ||||||
|           publish_dir: ./.unlighthouse |           publish_dir: ./.unlighthouse | ||||||
|           destination_dir: ${{ steps.git-branch.outputs.SOURCE_REF }} |           destination_dir: ${{ steps.git-branch.outputs.SOURCE_REF }} | ||||||
|  | 
 | ||||||
|  |       - name: Calculate Average Score | ||||||
|  |         id: calculate-score | ||||||
|  |         run: | | ||||||
|  |           average=$(jq -r '[.[] | .score] | add / length' ./.unlighthouse/ci-result.json) | ||||||
|  |           echo "::set-output name=average_score::$average" | ||||||
|  | 
 | ||||||
|  |       - name: Create Markdown Table | ||||||
|  |         id: create-table | ||||||
|  |         run: | | ||||||
|  |           echo "## Unlighthouse Results" > ./.unlighthouse/table.md | ||||||
|  |           echo "" >> ./.unlighthouse/table.md | ||||||
|  |           echo "Overall score: **${{ steps.calculate-score.outputs.average_score }}**" >> ./.unlighthouse/table.md | ||||||
|  |           echo "" >> ./.unlighthouse/table.md | ||||||
|  |           echo "Path | Score" >> ./.unlighthouse/table.md | ||||||
|  |           echo "-----|------" >> ./.unlighthouse/table.md | ||||||
|  |           cat ./.unlighthouse/ci-result.json | jq -r '.[] | [.path, .score] | @tsv' | sed 's/\t/ | /g' >> ./.unlighthouse/table.md | ||||||
|  |           echo "" >> ./.unlighthouse/table.md | ||||||
|  |           echo "[View the full report](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ steps.git-branch.outputs.SOURCE_REF }})" >> ./.unlighthouse/table.md | ||||||
|  |           echo "::set-output name=table_path::.unlighthouse/table.md" | ||||||
|  | 
 | ||||||
|  |       - name: Comment on Pull Request | ||||||
|  |         uses: actions/github-script@v6 | ||||||
|  |         with: | ||||||
|  |           script: | | ||||||
|  |             const fs = require('fs'); | ||||||
|  |             const tablePath = fs.readFileSync('${{ steps.create-table.outputs.table_path }}', 'utf8'); | ||||||
|  |             github.issues.createComment({ | ||||||
|  |               issue_number: context.issue.number, | ||||||
|  |               owner: context.repo.owner, | ||||||
|  |               repo: context.repo.repo, | ||||||
|  |               body: tablePath | ||||||
|  |             }); | ||||||
|  | 
 | ||||||
|  |       - name: Comment on issue | ||||||
|  |         id: create_comment | ||||||
|  |         uses: actions/github-script@v6 | ||||||
|  |         with: | ||||||
|  |           github-token: ${{secrets.GH_PAGES_TOKEN}} | ||||||
|  |           script: | | ||||||
|  |             const fs = require('fs'); | ||||||
|  |             const tablePath = fs.readFileSync('${{ steps.create-table.outputs.table_path }}', 'utf8'); | ||||||
|  | 
 | ||||||
|  |             github.rest.issues.createComment({ | ||||||
|  |               issue_number: context.issue.number, | ||||||
|  |               owner: context.repo.owner, | ||||||
|  |               repo: context.repo.repo, | ||||||
|  |               body: tablePath | ||||||
|  |             }) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue