Skip to content

Commit

Permalink
Update check_links.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tooomm committed Mar 16, 2024
1 parent 8e25b6a commit 87726d9
Showing 1 changed file with 19 additions and 27 deletions.
46 changes: 19 additions & 27 deletions .github/workflows/check_links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Check image links
runs-on: ubuntu-latest
env:
lychee_args: '--no-progress --require-https --cache --max-cache-age 1h --exclude http://www.w3.org'
lychee_args: '--no-progress --require-https --cache --max-cache-age 8h --exclude http://www.w3.org'

steps:
- name: Checkout
Expand All @@ -31,49 +31,41 @@ jobs:
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

- name: Extract picture URLs from tokens.xml
# Extract and check URLs directly from token files (checking dumped file did not work)
- name: Check token art URLs
uses: lycheeverse/lychee-action@v1
with:
args: '${{env.lychee_args}} -- tokens.xml'
fail: true
jobSummary: true

# Extract picture URLs from tokens.xml
- name: Extract URLs
id: tokens_pic_urls
uses: lycheeverse/lychee-action@v1
with:
args: '--dump --exclude www.w3.org -- tokens.xml'
output: lychee/out.md
fail: false
fail: true
jobSummary: false

- name: Print dumped output file
shell: bash
run: cat /tmp/lychee/out.md

# Analyse extracted links (1/2)
- name: List duplicated image links
if: steps.tokens_pic_urls.outcome == 'success'
shell: bash
# Remove blank lines | trim trailing integers (Scryfall) | sort | count and list duplicates
run: |
grep . /tmp/lychee/out.md | sed 's/\.jpg?.*/.jpg/' | sort | uniq -cd
echo "🪞 **Duplicated Image Links**" >> $GITHUB_STEP_SUMMARY
grep . lychee/out.md | sed 's/\.jpg?.*/.jpg/' | sort | uniq -cd >> $GITHUB_STEP_SUMMARY
# Analyse extracted links (2/2)
- name: List image hosting sources
if: steps.tokens_pic_urls.outcome == 'success'
shell: bash
# Extract domains from URLs | remove blank lines | sort | count and list | sort descending
run: |
awk -F/ '{print $3}' /tmp/lychee/out.md | grep . | sort | uniq -c | sort -nr
# Check already extracted URLs from tokens.xml
#- name: Check URLs from tokens.xml
# uses: lycheeverse/lychee-action@v1
# if: steps.tokens_pic_urls.outcome == 'success'
# with:
# args: '--no-progress --require-https --cache --max-cache-age 1h -- /tmp/lychee/out.md'
# fail: true
# jobSummary: true

# Extract and check URLs directly from token files
- name: Check token art URLs
uses: lycheeverse/lychee-action@v1
with:
args: '${{env.lychee_args}} -- tokens.xml challenge_tokens.xml'
fail: true
jobSummary: true
echo "📊 **Image Hosting Statistics**" >> $GITHUB_STEP_SUMMARY
awk -F/ '{print $3}' lychee/out.md | grep . | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
# Always save cache
- name: Save lychee cache
Expand Down

0 comments on commit 87726d9

Please sign in to comment.