Skip to content

Commit

Permalink
fixup! tools: add GitHub Action linter for pr-url
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Feb 8, 2021
1 parent 0f6847a commit d75f3e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 2
# GH Actions squash all commits into one, HEAD^ refers to the base branch.
# GH Actions squashes all PR commits, HEAD^ refers to the base branch.
- run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }}
4 changes: 2 additions & 2 deletions tools/lint-pr-url.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const fileDelimiter = /^\+\+\+ b\/(.+\.md)$/;
const changeDelimiter = /^@@ -\d+,\d+ \+(\d+),\d+ @@/;
const prUrlDefinition = /^\+\s+pr-url: (.+)$/;

const validatePrUrl = (url) => url == null || url === expectedPrUrl;

let currentFile;
let currentLine;

const validatePrUrl = (url) => url == null || url === expectedPrUrl;

const diff = readline.createInterface({ input: process.stdin });
for await (const line of diff) {
if (fileDelimiter.test(line)) {
Expand Down

0 comments on commit d75f3e9

Please sign in to comment.