-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: lighthouse (WIP) * ci: lighthouse (WIP) * ci: lighthouse (WIP) * ci: lighthouse * ci: set up permissions * ci: lighthouse * ci: lighthouse fix urls * ci: lighthouse - wait for deployment to finish
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Lighthouse Compare Action | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
getPreviewUrl: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
preview_url: ${{ steps.add_prefix.outputs.full_url }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#masking-a-value-in-a-log | ||
# https://kinsta.com/blog/github-actions-secret/ | ||
- name: Add Mask on vercel token | ||
run: echo "::add-mask::${{ secrets.VERCEL_TOKEN }}" | ||
- name: Get Vercel Preview URL | ||
id: vercel_preview_url | ||
uses: zentered/[email protected] | ||
env: | ||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | ||
with: | ||
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }} | ||
- name: Await for Vercel deployment | ||
uses: UnlyEd/[email protected] | ||
id: await-vercel | ||
env: | ||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | ||
with: | ||
deployment-url: ${{ steps.vercel_preview_url.outputs.preview_url }} | ||
timeout: 300 | ||
poll-interval: 5 | ||
- name: Combine Prefix "https://" | ||
id: add_prefix | ||
run: echo "full_url=https://${{ steps.vercel_preview_url.outputs.preview_url }}" >> $GITHUB_OUTPUT | ||
- name: Print URL | ||
run: echo "${{ steps.add_prefix.outputs.full_url }}" | ||
|
||
lighthouse: | ||
needs: getPreviewUrl | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
contents: write | ||
pull-requests: write | ||
issues: write | ||
env: | ||
# Subpaths to investigate | ||
SUBPATHS: "/games,/games/series,/games/dlcs,/planning,/backlog,/tests,/stats,/links" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: mkdir -p ${{ github.workspace }}/tmp/artifacts | ||
- name: Construct URLs | ||
id: construct_urls | ||
run: | | ||
URL_LIST=$(echo "${{ env.SUBPATHS }}" | tr ',' '\n' | sed "s|^|${{ needs.getPreviewUrl.outputs.preview_url }}|g" | tr '\n' ',' | sed 's|,$||') | ||
echo "url_list=$URL_LIST" >> $GITHUB_OUTPUT | ||
- name: Debug URLs | ||
run: | | ||
echo "Constructed URLs: ${{ steps.construct_urls.outputs.url_list }}" | ||
- uses: foo-software/lighthouse-check-action@master | ||
with: | ||
urls: ${{ steps.construct_urls.outputs.url_list }} | ||
device: all | ||
prCommentEnabled: true | ||
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }} | ||
outputDirectory: ${{ github.workspace }}/tmp/artifacts | ||
- name: Upload artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: Lighthouse reports | ||
path: ${{ github.workspace }}/tmp/artifacts | ||
retention-days: 1 |