mirror of
https://github.com/iminet/dev.git
synced 2026-10-15 01:24:54 +02:00
Added package version checker workflow
This commit is contained in:
@@ -22,7 +22,7 @@ jobs:
|
||||
dotnet-version: '10.0.x'
|
||||
|
||||
- name: Commit info
|
||||
run: echo "$GITHUB_REF_NAME / $GITHUB_SHA"
|
||||
run: echo "$GITHUB_REF_NAME / $GITHUB_SHA::7"
|
||||
|
||||
- name: Dotnet info
|
||||
run: dotnet --info
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
name: List unused GitHub Packages versions
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
|
||||
jobs:
|
||||
list-zero-downloads:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: List zero-download NuGet package versions
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PACKAGE_OWNER: ${{ github.repository_owner }}
|
||||
shell: bash
|
||||
run: |
|
||||
result="$(gh api graphql \
|
||||
-f query='query($owner: String!) {
|
||||
user(login: $owner) {
|
||||
packages(first: 100, packageType: NUGET) {
|
||||
nodes {
|
||||
name
|
||||
versions(first: 100) {
|
||||
nodes {
|
||||
version
|
||||
statistics { downloadsTotalCount }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}' \
|
||||
-f owner="$PACKAGE_OWNER")"
|
||||
|
||||
matches="$(printf '%s' "$result" | jq -r '
|
||||
.data.user.packages.nodes[]
|
||||
| .name as $package
|
||||
| .versions.nodes[]
|
||||
| select(.statistics != null and .statistics.downloadsTotalCount == 0)
|
||||
| "\($package) \(.version)"')"
|
||||
|
||||
if [[ -z "$matches" ]]; then
|
||||
echo "No zero-download NuGet package versions found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Zero-download NuGet package versions:"
|
||||
echo "$matches"
|
||||
Reference in New Issue
Block a user