Skip to content

Commit 823e77c

Browse files
erichermanixuz
andcommitted
default is "main" branch, not "develop"
fixes #112 Co-authored-by: Anton Wiklund <[email protected]> Signed-off-by: Eric Herman <[email protected]>
1 parent 1f5fab5 commit 823e77c

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- run: bundle install
2020
- run: ./script/test-markdown.sh
2121
- run: ./script/test-without-link-check.sh
22-
- run: ./script/check-new-links.sh
22+
- run: VERBOSE=1 ./script/check-new-links.sh

script/check-new-links.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
2+
set -e
3+
set -o pipefail
24

35
# This script is referenced by .github/workflows/test.yml which executes on
46
# each pull request.
@@ -18,9 +20,18 @@ SKIP_PATTERNS=(
1820

1921
if [ "_${VERBOSE}_" == "__" ]; then VERBOSE=0; fi
2022

21-
for URL in $(git diff develop |
23+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
24+
REMOTE=$(git config branch.$BRANCH.remote)
25+
git fetch --depth=1 $REMOTE main
26+
27+
# the second grep is allowed to "fail" without matching
28+
URLS=$(git diff main |
2229
grep '^+' |
23-
grep -Eo '(http|https)://[^ )"><]+'); do
30+
grep --extended-regexp --only-matching \
31+
'(http|https)://[^ )"><]+' || true
32+
)
33+
34+
for URL in $URLS; do
2435
SKIP_URL=0
2536
for PATTERN in "${SKIP_PATTERNS[@]}"; do
2637
if echo "$URL" | grep --quiet --extended-regexp "$PATTERN"

0 commit comments

Comments
 (0)