├── Makefile ├── Dockerfile ├── readme.md ├── action.yml └── entrypoint.sh /Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | DOCKER_IMAGE := gonitro/markdown-link-check-action:1 3 | 4 | .PHONY: docker-build 5 | docker-build: 6 | @docker build -t $(DOCKER_IMAGE) -f Dockerfile . 7 | 8 | .PHONY: docker-push 9 | docker-push: 10 | @docker push $(DOCKER_IMAGE) 11 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:buster-20200422-slim 2 | 3 | RUN apt-get update \ 4 | && apt-get install -y --no-install-recommends curl=7.64.* ca-certificates=2019* chromium=83.* \ 5 | && rm -rf /var/lib/apt/lists/* 6 | 7 | COPY entrypoint.sh /entrypoint.sh 8 | 9 | ENTRYPOINT ["/entrypoint.sh"] -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Markdown Link Check Action 2 | This action uses [markdown-link-check](https://github.com/Nitro/markdown-link-check) to check for broken links at markdown files. 3 | 4 | ## Inputs 5 | ### `version` 6 | Not required. Default value `v0.1.0`. 7 | The version correspond to these [releases](https://github.com/Nitro/markdown-link-check/releases). 8 | 9 | ### `config` 10 | Not required. Default value `markdown-link-check.yml`. 11 | 12 | ### `path` 13 | Not required. Default value `.`. 14 | 15 | ## Example usage 16 | ```yml 17 | uses: Nitro/markdown-link-check-action@v1 18 | with: 19 | version: v0.1.0 20 | config: markdown-link-check.yml 21 | path: . 22 | ``` 23 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: Markdown Link Check 2 | description: Check for broken links at markdown files 3 | inputs: 4 | version: 5 | description: Version of the markdown-link-check 6 | required: false 7 | default: v0.1.0 8 | 9 | config: 10 | description: Path to the configuration file 11 | required: false 12 | default: markdown-link-check.yml 13 | 14 | path: 15 | description: Path to the folder containing the markdown files 16 | required: false 17 | default: . 18 | 19 | runs: 20 | using: docker 21 | image: docker://gonitro/markdown-link-check-action:1 22 | args: 23 | - --version 24 | - ${{ inputs.version }} 25 | - --config 26 | - ${{ inputs.config }} 27 | - --path 28 | - ${{ inputs.path }} 29 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -l 2 | 3 | # Exit with a error status in case of command error. 4 | set -e 5 | 6 | # Read the parameters. 7 | while [[ "$#" -gt 0 ]]; do 8 | case $1 in 9 | --version) version="$2"; shift ;; 10 | --config) config="$2"; shift ;; 11 | --path) path="$2"; shift ;; 12 | *) echo "Unknown parameter passed: $1"; exit 1 ;; 13 | esac 14 | shift 15 | done 16 | 17 | # Download the release. 18 | curl --silent --show-error -L -o markdown-link-check.tar.gz "https://github.com/Nitro/markdown-link-check/releases/download/${version}/markdown-link-check_${version}_linux_amd64.tar.gz" 19 | 20 | # Uncompress. 21 | tar xf markdown-link-check.tar.gz 22 | 23 | # Move the binary to '/usr/bin'. 24 | mv "markdown-link-check_${version}_linux_amd64/markdown-link-check" /usr/bin/ 25 | 26 | # Remove the temporary files. 27 | rm -Rf markdown-link-check* 28 | 29 | # Excute the command. 30 | markdown-link-check --config "$config" "$path" --------------------------------------------------------------------------------