Skip to content

Commit

Permalink
actions: adding a workflow to check for stale hints
Browse files Browse the repository at this point in the history
  • Loading branch information
mtzguido committed Oct 24, 2024
1 parent a6a8ba7 commit 265b01e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/stale_hints.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check for stale hints
on:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- run: |
L=$(.scripts/remove_stale_hints.sh list)
if [ "$L" != "" ]; then
echo "There are stale hints:"
echo "$L"
false
fi
13 changes: 11 additions & 2 deletions .scripts/remove_stale_hints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -eu

list=false
if [ $# -gt 0 ] && [ $1 == "list" ]; then
list=true
fi

declare -A files # Store all basenames in repo
declare -A hints # Store all paths of hints in repo

Expand All @@ -27,7 +32,11 @@ for h0 in "${!hints[@]}"; do
# Given a/b/c/Foo.Bar.fst.hints, if there is no Foo.Bar.fst
# anywhere, then delete the hint file.
if ! [ -v "files[$h]" ]; then
echo "DELETING HINT $h0"
rm -f "${h0}"
if $list; then
echo "$h0"
else
echo "DELETING HINT $h0"
rm -f "${h0}"
fi
fi
done

0 comments on commit 265b01e

Please sign in to comment.