Skip to content

Commit 151ab9b

Browse files
committed
feat: Add regup tool and daily metadata update workflow
- Created regup tool to update registry entry metadata - Updates GitHub stars from API and increments pulls - Supports provenance verification - Added daily workflow to update 5 oldest entries - Workflow creates PR with changes - Can be manually triggered with custom count Note: YAML marshaling currently removes comments - needs fix in future iteration
1 parent 6e007e6 commit 151ab9b

File tree

4 files changed

+2209
-3
lines changed

4 files changed

+2209
-3
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Update Registry Metadata
2+
3+
on:
4+
schedule:
5+
# Run daily at 2:00 AM UTC
6+
- cron: '0 2 * * *'
7+
workflow_dispatch:
8+
inputs:
9+
count:
10+
description: 'Number of oldest entries to update'
11+
required: false
12+
default: '5'
13+
type: string
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
update-metadata:
21+
name: Update Registry Metadata
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Set up Go
30+
uses: actions/setup-go@v5
31+
with:
32+
go-version-file: 'go.mod'
33+
cache: true
34+
35+
- name: Build regup
36+
run: go build -o regup ./cmd/regup
37+
38+
- name: Get oldest entries
39+
id: get-entries
40+
run: |
41+
# Find all spec.yaml files and sort by metadata.lastupdated (oldest first)
42+
# Default to 5 entries or use workflow input
43+
COUNT="${{ github.event.inputs.count || '5' }}"
44+
45+
echo "Finding $COUNT oldest entries..."
46+
47+
# Find all spec files
48+
SPECS=$(find registry -name "spec.yaml" -type f)
49+
50+
# Create a temporary file to store entries with their last updated time
51+
TEMP_FILE=$(mktemp)
52+
53+
for spec in $SPECS; do
54+
# Extract lastupdated field, default to epoch if not found
55+
LAST_UPDATED=$(grep -A1 "metadata:" "$spec" | grep "lastupdated:" | cut -d'"' -f2 || echo "1970-01-01T00:00:00Z")
56+
echo "$LAST_UPDATED $spec" >> "$TEMP_FILE"
57+
done
58+
59+
# Sort by date and take the oldest entries
60+
OLDEST_SPECS=$(sort "$TEMP_FILE" | head -n "$COUNT" | cut -d' ' -f2-)
61+
62+
# Save to output
63+
echo "specs<<EOF" >> $GITHUB_OUTPUT
64+
echo "$OLDEST_SPECS" >> $GITHUB_OUTPUT
65+
echo "EOF" >> $GITHUB_OUTPUT
66+
67+
# Clean up
68+
rm "$TEMP_FILE"
69+
70+
echo "Selected entries:"
71+
echo "$OLDEST_SPECS"
72+
73+
- name: Update metadata for oldest entries
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
run: |
77+
# Update each spec file
78+
IFS=$'\n'
79+
for spec in ${{ steps.get-entries.outputs.specs }}; do
80+
if [ -n "$spec" ]; then
81+
echo "Updating metadata for $spec"
82+
./regup "$spec" || echo "Warning: Failed to update $spec"
83+
fi
84+
done
85+
86+
- name: Check for changes
87+
id: check-changes
88+
run: |
89+
if git diff --quiet; then
90+
echo "No changes detected"
91+
echo "changed=false" >> $GITHUB_OUTPUT
92+
else
93+
echo "Changes detected"
94+
echo "changed=true" >> $GITHUB_OUTPUT
95+
git diff --stat
96+
fi
97+
98+
- name: Create Pull Request
99+
if: steps.check-changes.outputs.changed == 'true'
100+
uses: peter-evans/create-pull-request@v6
101+
with:
102+
token: ${{ secrets.GITHUB_TOKEN }}
103+
commit-message: 'chore: update registry metadata (stars and pulls)'
104+
title: 'chore: update registry metadata'
105+
body: |
106+
## 🔄 Registry Metadata Update
107+
108+
This PR updates the GitHub stars and Docker pulls counts for the oldest registry entries.
109+
110+
### Updated Entries
111+
```
112+
${{ steps.get-entries.outputs.specs }}
113+
```
114+
115+
---
116+
*This is an automated PR created by the daily metadata update workflow.*
117+
branch: update-metadata-${{ github.run_number }}
118+
delete-branch: true
119+
labels: |
120+
dependencies
121+
automated

cmd/regup/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ import (
77
"errors"
88
"fmt"
99
"io"
10-
"log"
1110
"net/http"
1211
"os"
1312
"path/filepath"
14-
"sort"
1513
"strings"
1614
"time"
1715

go.mod

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,160 @@ require (
1111

1212
require (
1313
al.essio.dev/pkg/shellescape v1.6.0 // indirect
14+
cel.dev/expr v0.23.1 // indirect
15+
cloud.google.com/go v0.121.1 // indirect
16+
cloud.google.com/go/auth v0.16.2 // indirect
17+
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
18+
cloud.google.com/go/compute/metadata v0.7.0 // indirect
19+
cloud.google.com/go/iam v1.5.2 // indirect
20+
cloud.google.com/go/longrunning v0.6.7 // indirect
21+
cloud.google.com/go/monitoring v1.24.2 // indirect
22+
cloud.google.com/go/spanner v1.82.0 // indirect
23+
cloud.google.com/go/storage v1.55.0 // indirect
1424
github.com/1password/onepassword-sdk-go v0.3.1 // indirect
25+
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
26+
github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.2 // indirect
27+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 // indirect
28+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 // indirect
29+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 // indirect
30+
github.com/Microsoft/go-winio v0.6.2 // indirect
1531
github.com/adrg/xdg v0.5.3 // indirect
32+
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
33+
github.com/avast/retry-go/v4 v4.6.1 // indirect
34+
github.com/blang/semver v3.5.1+incompatible // indirect
35+
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
36+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
37+
github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f // indirect
38+
github.com/containerd/errdefs v1.0.0 // indirect
39+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
40+
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
41+
github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467 // indirect
1642
github.com/danieljoos/wincred v1.2.2 // indirect
1743
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
44+
github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 // indirect
45+
github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7 // indirect
46+
github.com/distribution/reference v0.6.0 // indirect
47+
github.com/docker/cli v28.2.2+incompatible // indirect
48+
github.com/docker/distribution v2.8.3+incompatible // indirect
49+
github.com/docker/docker v28.3.3+incompatible // indirect
50+
github.com/docker/docker-credential-helpers v0.9.3 // indirect
51+
github.com/docker/go-connections v0.6.0 // indirect
52+
github.com/docker/go-units v0.5.0 // indirect
1853
github.com/dylibso/observe-sdk/go v0.0.0-20240819160327-2d926c5d788a // indirect
54+
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
55+
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
1956
github.com/extism/go-sdk v1.7.0 // indirect
57+
github.com/felixge/httpsnoop v1.0.4 // indirect
2058
github.com/fsnotify/fsnotify v1.8.0 // indirect
59+
github.com/globocom/go-buffer v1.2.2 // indirect
60+
github.com/go-chi/chi v4.1.2+incompatible // indirect
61+
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
2162
github.com/go-logr/logr v1.4.3 // indirect
63+
github.com/go-logr/stdr v1.2.2 // indirect
64+
github.com/go-openapi/analysis v0.23.0 // indirect
65+
github.com/go-openapi/errors v0.22.1 // indirect
66+
github.com/go-openapi/jsonpointer v0.21.1 // indirect
67+
github.com/go-openapi/jsonreference v0.21.0 // indirect
68+
github.com/go-openapi/loads v0.22.0 // indirect
69+
github.com/go-openapi/runtime v0.28.0 // indirect
70+
github.com/go-openapi/spec v0.21.0 // indirect
71+
github.com/go-openapi/strfmt v0.23.0 // indirect
72+
github.com/go-openapi/swag v0.23.1 // indirect
73+
github.com/go-openapi/validate v0.24.0 // indirect
2274
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
2375
github.com/gobwas/glob v0.2.3 // indirect
2476
github.com/godbus/dbus/v5 v5.1.0 // indirect
2577
github.com/gofrs/flock v0.12.1 // indirect
78+
github.com/gogo/protobuf v1.3.2 // indirect
79+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
80+
github.com/google/certificate-transparency-go v1.3.2 // indirect
81+
github.com/google/go-cmp v0.7.0 // indirect
82+
github.com/google/go-containerregistry v0.20.6 // indirect
83+
github.com/google/s2a-go v0.1.9 // indirect
84+
github.com/google/uuid v1.6.0 // indirect
85+
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
86+
github.com/googleapis/gax-go/v2 v2.14.2 // indirect
87+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
88+
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
2689
github.com/ianlancetaylor/demangle v0.0.0-20240805132620-81f5be970eca // indirect
90+
github.com/in-toto/attestation v1.1.2 // indirect
91+
github.com/in-toto/in-toto-golang v0.9.0 // indirect
2792
github.com/inconshreveable/mousetrap v1.1.0 // indirect
93+
github.com/jedisct1/go-minisign v0.0.0-20211028175153-1c139d1cc84b // indirect
94+
github.com/josharian/intern v1.0.0 // indirect
95+
github.com/klauspost/compress v1.18.0 // indirect
96+
github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec // indirect
2897
github.com/lmittmann/tint v1.1.2 // indirect
98+
github.com/mailru/easyjson v0.9.0 // indirect
99+
github.com/mitchellh/go-homedir v1.1.0 // indirect
100+
github.com/mitchellh/mapstructure v1.5.0 // indirect
101+
github.com/moby/docker-image-spec v1.3.1 // indirect
102+
github.com/oklog/ulid v1.3.1 // indirect
103+
github.com/opencontainers/go-digest v1.0.0 // indirect
104+
github.com/opencontainers/image-spec v1.1.1 // indirect
105+
github.com/opentracing/opentracing-go v1.2.0 // indirect
29106
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
107+
github.com/pkg/errors v0.9.1 // indirect
108+
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
30109
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
31110
github.com/sagikazarmark/locafero v0.7.0 // indirect
111+
github.com/sassoftware/relic v7.2.1+incompatible // indirect
112+
github.com/secure-systems-lab/go-securesystemslib v0.9.0 // indirect
113+
github.com/shibumi/go-pathspec v1.3.0 // indirect
114+
github.com/sigstore/protobuf-specs v0.5.0 // indirect
115+
github.com/sigstore/rekor v1.3.10 // indirect
116+
github.com/sigstore/rekor-tiles v0.1.7-0.20250624231741-98cd4a77300f // indirect
117+
github.com/sigstore/sigstore v1.9.5 // indirect
118+
github.com/sigstore/sigstore-go v1.1.0 // indirect
119+
github.com/sigstore/timestamp-authority v1.2.8 // indirect
120+
github.com/sirupsen/logrus v1.9.3 // indirect
32121
github.com/sourcegraph/conc v0.3.0 // indirect
33122
github.com/spf13/afero v1.12.0 // indirect
34123
github.com/spf13/cast v1.7.1 // indirect
35124
github.com/spf13/pflag v1.0.6 // indirect
36125
github.com/spf13/viper v1.20.1 // indirect
126+
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
37127
github.com/subosito/gotenv v1.6.0 // indirect
38128
github.com/tetratelabs/wabin v0.0.0-20230304001439-f6f874872834 // indirect
39129
github.com/tetratelabs/wazero v1.9.0 // indirect
130+
github.com/theupdateframework/go-tuf v0.7.0 // indirect
131+
github.com/theupdateframework/go-tuf/v2 v2.1.1 // indirect
132+
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect
133+
github.com/transparency-dev/formats v0.0.0-20250421220931-bb8ad4d07c26 // indirect
134+
github.com/transparency-dev/merkle v0.0.2 // indirect
135+
github.com/transparency-dev/tessera v0.2.1-0.20250610150926-8ee4e93b2823 // indirect
136+
github.com/vbatts/tar-split v0.12.1 // indirect
40137
github.com/zalando/go-keyring v0.2.6 // indirect
138+
github.com/zeebo/errs v1.4.0 // indirect
139+
go.mongodb.org/mongo-driver v1.14.0 // indirect
140+
go.opencensus.io v0.24.0 // indirect
141+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
142+
go.opentelemetry.io/contrib/detectors/gcp v1.36.0 // indirect
143+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
144+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
145+
go.opentelemetry.io/otel v1.37.0 // indirect
146+
go.opentelemetry.io/otel/metric v1.37.0 // indirect
147+
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
148+
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
149+
go.opentelemetry.io/otel/trace v1.37.0 // indirect
41150
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
42151
go.uber.org/multierr v1.11.0 // indirect
152+
go.uber.org/zap v1.27.0 // indirect
153+
golang.org/x/crypto v0.40.0 // indirect
154+
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
155+
golang.org/x/mod v0.27.0 // indirect
156+
golang.org/x/net v0.42.0 // indirect
43157
golang.org/x/oauth2 v0.30.0 // indirect
44158
golang.org/x/sync v0.16.0 // indirect
45159
golang.org/x/sys v0.35.0 // indirect
46160
golang.org/x/term v0.34.0 // indirect
47161
golang.org/x/text v0.27.0 // indirect
162+
golang.org/x/time v0.12.0 // indirect
163+
google.golang.org/api v0.238.0 // indirect
164+
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 // indirect
165+
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect
166+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
167+
google.golang.org/grpc v1.73.0 // indirect
48168
google.golang.org/protobuf v1.36.6 // indirect
169+
k8s.io/klog/v2 v2.130.1 // indirect
49170
)

0 commit comments

Comments
 (0)