Skip to content

Commit

Permalink
prevent using branch names or shortened commit hashes for github blob…
Browse files Browse the repository at this point in the history
… source URLs
  • Loading branch information
moritzbuhl authored Aug 13, 2024
1 parent 1882bca commit e06efd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/json-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,12 @@ jobs:
FILTER_REGEX_INCLUDE: .*data/.*
DEFAULT_BRANCH: "main"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lint Source URLs
run: >-
for url in $(jq .items[].source_url < data/entries.json); do
echo $url | grep -q blob && (echo $url | sed -nr \
's,^"https://github.com/[^\/]*/[^\/]*/blob/([^/]*)/.+$,\1,p' |
grep -q '[0-9a-f]\{40\}' || (echo \
"Error: $url does not contain a commit hash." && exit 1));
done
2 changes: 1 addition & 1 deletion data/entries.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"COPA"
],
"source": "Repo",
"source_url": "https://github.com/Tencent/tquic/blob/develop/README.md?plain=1#L19",
"source_url": "https://github.com/Tencent/tquic/blob/04e656cb68100caad9cdd1ad1e31b10be6799b07/README.md?plain=1#L19",
"created_at": "2024-01-30T10:45:00.000000Z",
"created_by": "Benedikt Spies <benedikt.spies@in.tum.de>"
},
Expand Down

0 comments on commit e06efd2

Please sign in to comment.