Skip to content

Commit

Permalink
Update docs, only run on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
marccampbell committed Feb 8, 2019
1 parent 7fb4013 commit eed15fd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/main.workflow
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ action "Build" {
action "Publish Filter" {
needs = ["Build"]
uses = "actions/bin/filter@master"
args = "branch master"
args = "tag"
}

action "Docker Login" {
Expand Down
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
# Contributing

Clone this repo, and run

```
make test
```

To locally run end-to-end tests in a Docker container, and more closely match the GitHub Action environment, you can riun

```
make test-docker
```

To run locally, without Docker:

```
$ make build && \
node --no-deprecation ./build/hugo-linkcheck-action.js scan https://www.mysite.com
```

# Why is this javascript instead of just bash?

Many GitHub actions are simply an `entrypoint.sh`, intead of code that can be compiled. This is recommended because it's more transparant and often easy to wrap everything in a bash script. For this project, I wanted to use the great work work in the `broken-link-checker` module, but that project is designed to run independently today. The output is not controllable frmo the UI. The original version of this Action used it, and had some rather difficult to grok sed and grep statements to collect the output. In the end, it's much more maintainable as a few lines of javascript, instead of hard-to-read bash.


5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Builds a Hugo site and validates that there are no broken links in the site. Any broken links will be reported as a comment on the pull request.

This Action uses the [stevenvachon/broken-link-checker](https://github.com/stevenvachon/broken-link-checker) module to crawl and report broken links.

### Quick Start

Add a new [GitHub Action](https://github.com/features/actions) to your repo. You can create a file named `.github/main.workflow` and use this as a quick start:
Expand All @@ -21,6 +23,9 @@ action "linkcheck" {
uses = "docker://marc/hugo-linkcheck:master"
needs = "filter-to-pr-open-synced"
secrets = ["GITHUB_TOKEN"]
env = {
HUGO_FINAL_URL = "https://mysite.com"
}
}
```

Expand Down
1 change: 0 additions & 1 deletion src/commands/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import* as fs from "fs";
import { logger } from "../logger";
import * as blc from "broken-link-checker";
import * as Octokit from "@octokit/rest";
import { fileURLToPath } from "url";

exports.name = "scan";
exports.describe = "Scan a web site for broken links";
Expand Down

0 comments on commit eed15fd

Please sign in to comment.