Skip to content

Commit

Permalink
fixup! feat(ci): go list check versions available for untagged depend…
Browse files Browse the repository at this point in the history
…encies
  • Loading branch information
rvagg committed Dec 12, 2024
1 parent 4c71ac8 commit 4158ab3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
runs-on: ubuntu-latest
name: Dependency Check
env:
V0_PATTERN: 'v0\.0\.0-[0-9]{14}-[0-9a-f]{7,}$'
RELEASE_PATTERN: 'v[0-9]+\.[0-9]+\.[0-9]+(\+incompatible)?$'
V0_PATTERN: 'v0\.0\.0-[0-9]{14}-[0-9a-f]{7,}(\s*(\/\/.*)?)?$'
RELEASE_PATTERN: 'v[0-9]+\.[0-9]+\.[0-9]+(\+incompatible)?(\s*(\/\/.*)?)?$'
IGNORE_PATTERN: 'dependency-check-ignore:\s'

steps:
Expand All @@ -36,8 +36,7 @@ jobs:
DEPENDENCIES: ${{ steps.all.outputs.dependencies }}
run: |
echo "dependencies<<EOF" >> $GITHUB_OUTPUT
# Strip '// indirect' so we all dependencies the same
sed 's/\/\/\s*indirect//' <<< "$DEPENDENCIES" | grep -Pv "$V0_PATTERN|$RELEASE_PATTERN" | tee -a $GITHUB_OUTPUT
grep -Pv "$V0_PATTERN|$RELEASE_PATTERN" <<< "$DEPENDENCIES" | tee -a $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Extract unexplained dependencies
Expand All @@ -53,10 +52,9 @@ jobs:
id: v0check
run: |
echo "tagged<<EOF" >> $GITHUB_OUTPUT
# Only check direct dependencies - exclude indirect ones entirely
grep -P "$V0_PATTERN" go.mod | grep -Pv "$IGNORE_PATTERN" | grep -Pv "\/\/\s*indirect/" | while read -r line; do
grep -P "$V0_PATTERN" go.mod | grep -Pv "$IGNORE_PATTERN" | while read -r line; do
dep=$(echo "$line" | cut -d' ' -f1)
if [ ! -z "$(go list -m -versions $dep 2>/dev/null | awk 'NF>1')" ]; then
if [ ! -z "$(go list -m -versions $dep 2>/dev/null)" ]; then
echo "$dep"
fi
done | tee -a $GITHUB_OUTPUT
Expand Down

0 comments on commit 4158ab3

Please sign in to comment.