Skip to content

Commit 01e2543

Browse files
authored
Use reusable workflows over a GitHub Action (#17)
* Minor improvements to build, fix prettier * Remove github action * Add reusable workflows
1 parent 384b1a7 commit 01e2543

File tree

17 files changed

+1262
-1669
lines changed

17 files changed

+1262
-1669
lines changed

.eslintrc.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ module.exports = {
33
parserOptions: {
44
sourceType: "module",
55
},
6-
extends: [
7-
"airbnb-base",
8-
"plugin:@typescript-eslint/recommended",
9-
"prettier",
10-
"prettier/@typescript-eslint",
11-
],
6+
extends: ["airbnb-base", "plugin:@typescript-eslint/recommended", "prettier"],
127
plugins: ["import", "prettier", "@typescript-eslint"],
138
env: {
149
browser: false,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Check all links in the repository
2+
on:
3+
workflow_call:
4+
inputs:
5+
config:
6+
description: "The path to the link-check config file"
7+
default: "config/link-check/config.yml"
8+
jobs:
9+
run:
10+
name: Link Check All
11+
runs-on: ubuntu-latest
12+
env:
13+
NODE_OPTIONS: '--max-http-header-size=65536'
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Run Link Check
17+
id: check
18+
run: npx repo-link-check -c ${{ inputs.config }}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Check new links against deployment
2+
on:
3+
workflow_call:
4+
inputs:
5+
main:
6+
description: "The main branch of this repository"
7+
default: "main"
8+
jobs:
9+
run:
10+
name: Run
11+
runs-on: ubuntu-latest
12+
if:
13+
github.event.deployment.ref != ${{ inputs.main }} &&
14+
github.event.deployment_status.state == 'success'
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- name: Run Link Check
20+
id: check
21+
run: |
22+
set +e
23+
body="$(
24+
npx repo-link-check \
25+
-d ${{ main }} -c config/link-check/config.yml \
26+
-r ${{ github.event.deployment.payload.web_url }}
27+
)"
28+
body="${body//'%'/'%25'}"
29+
body="${body//$'\n'/'%0A'}"
30+
body="${body//$'\r'/'%0D'}"
31+
echo "::set-output name=report::$body"
32+
exit 0
33+
34+
- name: Find Current Pull Request
35+
id: findPr
36+
uses: jwalton/gh-find-current-pr@v1.3.0
37+
38+
- name: Find Existing Link Check Report Comment
39+
uses: peter-evans/find-comment@v2
40+
id: findComment
41+
continue-on-error: true
42+
with:
43+
issue-number: ${{ steps.findPr.outputs.pr }}
44+
comment-author: 'github-actions[bot]'
45+
body-includes: <h1 id="link-check">Link Check Report</h1>
46+
47+
- name: Create or update comment
48+
uses: peter-evans/create-or-update-comment@v2
49+
with:
50+
issue-number: ${{ steps.findPr.outputs.pr }}
51+
comment-id: ${{ steps.findComment.outputs.comment-id }}
52+
body: |
53+
<h1 id="link-check">Link Check Report</h1>
54+
55+
${{ steps.check.outputs.report }}
56+
edit-mode: replace

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)