Skip to content

Commit

Permalink
ci: optimize lighthouse script (#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
jy95 authored Dec 1, 2024
1 parent d197062 commit 639b582
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ name: Lighthouse Compare Action
on:
pull_request:

env:
# Subpaths to investigate
SUBPATHS: "/games,/games/series,/games/dlcs,/planning,/backlog,/tests,/stats,/links"

jobs:

getPreviewUrl:
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -39,28 +36,39 @@ jobs:
- name: Print URL
run: echo "${{ steps.add_prefix.outputs.full_url }}"

lighthouse_mobile:
constructUrls:
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"
outputs:
url_list: ${{ steps.construct_url_list.outputs.url_list }}
steps:
- uses: actions/checkout@v4
- run: mkdir -p ${{ github.workspace }}/tmp/artifacts
- name: Construct URLs
id: construct_urls
id: construct_url_list
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 }}"
echo "Constructed URLs: ${{ steps.construct_url_list.outputs.url_list }}"
lighthouse_mobile:
needs: constructUrls
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v4
- run: mkdir -p ${{ github.workspace }}/tmp/artifacts
- uses: foo-software/lighthouse-check-action@master
with:
urls: ${{ steps.construct_urls.outputs.url_list }}
urls: ${{ needs.constructUrls.outputs.url_list }}
device: mobile
prCommentEnabled: true
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -73,7 +81,7 @@ jobs:
retention-days: 1

lighthouse_desktop:
needs: getPreviewUrl
needs: constructUrls
runs-on: ubuntu-latest
permissions:
actions: write
Expand All @@ -83,17 +91,9 @@ jobs:
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 }}
urls: ${{ needs.constructUrls.outputs.url_list }}
device: desktop
prCommentEnabled: true
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 639b582

Please sign in to comment.