Skip to content

Commit

Permalink
Merge branch 'master' into fail-if-empty
Browse files Browse the repository at this point in the history
  • Loading branch information
mre authored Apr 25, 2024
2 parents 8580a7b + 16d24de commit e52f6c9
Show file tree
Hide file tree
Showing 16 changed files with 486 additions and 124 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
open_collective: lychee-collective
github: mre
17 changes: 17 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Merge Dependencies'

on:
pull_request:

jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- uses: actions/checkout@v4
- uses: ahmadnassri/[email protected]
with:
github-token: ${{ secrets.AUTOMERGE_TOKEN }}
# Merge all updates as long as they pass CI.
# Includes minor and patch updates.
update_type: "semver:major"
8 changes: 5 additions & 3 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- uses: actions/checkout@v4

- name: Link Checker
uses: ./ # Uses an action in the root directory
with:
args: --verbose --no-progress --exclude lycheeverse/lychee-action@.* -- './**/*.md' './**/*.html'
args: --user-agent "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" --verbose --exclude spinroot.com --no-progress './**/*.md' './**/*.html' './**/*.rst'
fail: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Create Issue From File
uses: peter-evans/create-issue-from-file@v3
if: env.lychee_exit_code != 0
uses: peter-evans/create-issue-from-file@v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/main.yml

This file was deleted.

162 changes: 162 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
on:
- repository_dispatch
- workflow_dispatch
- push
- pull_request

env:
CUSTOM_OUTPUT_RELATIVE_PATH: lychee/custom_output.md
CUSTOM_OUTPUT_ABSOLUTE_PATH: /tmp/report.md
CUSTOM_OUTPUT_DUMP_PATH: /tmp/dump.md

jobs:
lychee-action:
runs-on: ubuntu-latest
continue-on-error: true
name: Test the lychee link checker action
steps:
- name: Checkout
uses: actions/checkout@v4

- name: test defaults
uses: ./
with:
fail: true

- name: test explicit lychee version
uses: ./
with:
lycheeVersion: v0.14.0

- name: test globs
uses: ./
with:
args: >-
--exclude-mail
--verbose
--no-progress
'./**/*.md'
'./**/*.html'
'./**/*.rst'
fail: true

- name: test --base argument
uses: ./
with:
args: >-
--base .
--verbose
--no-progress
'./**/*.md'
'./**/*.html'
'./**/*.rst'
fail: true

- name: test custom output relative path - creation
uses: ./
with:
output: "${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}"
debug: true

- name: test custom output relative path - validation
run: |
echo "Checking custom output file at ${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}"
if [ ! -f "${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}" ]; then
echo "Not found"
exit 1
else
echo "Found. Contents:"
cat "${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}"
fi
- name: test custom output absolute path - creation
uses: ./
with:
output: "${{ env.CUSTOM_OUTPUT_ABSOLUTE_PATH }}"
debug: true

- name: test custom output absolute path - validation
run: |
echo "Checking custom output file at ${{ env.CUSTOM_OUTPUT_ABSOLUTE_PATH }}"
if [ ! -f "${{ env.CUSTOM_OUTPUT_ABSOLUTE_PATH }}" ]; then
echo "Not found"
exit 1
else
echo "Found. Contents:"
cat "${{ env.CUSTOM_OUTPUT_ABSOLUTE_PATH }}"
fi
- name: test dump with custom output path - creation
uses: ./
with:
args: --dump './**/*.md' './**/*.html' './**/*.rst'
output: "${{ env.CUSTOM_OUTPUT_DUMP_PATH }}"
debug: true

- name: test dump with custom output path - validation
run: |
echo "Checking dump output file at ${{ env.CUSTOM_OUTPUT_DUMP_PATH }}"
if [ ! -f "${{ env.CUSTOM_OUTPUT_DUMP_PATH }}" ]; then
echo "Not found"
exit 1
else
echo "Found. Contents:"
cat "${{ env.CUSTOM_OUTPUT_DUMP_PATH }}"
fi
- name: Install jq
run: sudo apt-get install jq

- name: test workflow inputs - Markdown
uses: ./
with:
args: -v fixtures/TEST.md
format: json
output: ${{ github.workspace }}/foo_md.json
fail: true

- name: Validate JSON - Markdown
run: |
if ! jq empty ${{ github.workspace }}/foo_md.json; then
echo "Output file does not exist or is not valid JSON"
exit 1
fi
- name: test workflow inputs - rST
uses: ./
with:
args: -v fixtures/TEST.rst
format: json
output: ${{ github.workspace }}/foo_rst.json
fail: true

- name: Validate JSON - rST
run: |
if ! jq empty ${{ github.workspace }}/foo_rst.json; then
echo "Output file does not exist or is not valid JSON"
exit 1
fi
- name: directory
uses: ./
with:
args: --exclude-mail .
fail: true

- name: test format override
uses: ./
with:
args: --format markdown -v fixtures/TEST.md
format: doesnotexist # gets ignored if format set in args
output: ${{ github.workspace }}/foo.txt
fail: true

- name: test debug
uses: ./
with:
debug: true

- name: test custom GitHub token
uses: ./
with:
token: ${{ secrets.CUSTOM_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/test_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
- repository_dispatch
- workflow_dispatch
- push
- pull_request

jobs:
lychee-action:
runs-on: ubuntu-latest
continue-on-error: true
name: Test cache
steps:
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

- uses: actions/checkout@v4

- name: Lychee URL checker
uses: lycheeverse/lychee-action@v1
with:
args: >-
--cache
--verbose
--no-progress
'./**/*.md'
'./**/*.html'
'./**/*.rst'
# Fail the action on broken links.
# If the pipeline fails, the cache will _not_ be stored
fail: true
env:
# to be used in case rate limits are surpassed
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
15 changes: 15 additions & 0 deletions .github/workflows/versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Keep major version tags up-to-date

on:
release:
types: [published, edited]

jobs:
actions-tagger:
name: Tag GitHub Action
runs-on: ubuntu-latest
steps:
- uses: Actions-R-Us/actions-tagger@v2
with:
publish_latest_tag: false
prefer_branch_releases: false
2 changes: 2 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lycheeverse/lychee-action@.*
https://github.com/org/repo
17 changes: 0 additions & 17 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE-APACHE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2020 The lychee maintainers
Copyright 2022 The lychee maintainers

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 The lychee maintainers
Copyright (c) 2022 The lychee maintainers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit e52f6c9

Please sign in to comment.