Skip to content

Commit b8acb0f

Browse files
ceritiumclaude
andcommitted
Add reusable GitHub Actions workflow for syncing stacktodate config
Add a new workflow that runs on push to main/master branches to: - Download the latest stacktodate CLI binary from releases - Verify the stacktodate.yml configuration matches detected versions - Push the configuration to the remote API for tracking By using a pre-built binary instead of building from source, this workflow is reusable for other repositories without requiring the stacktodate-cli source code. 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <[email protected]>
2 parents 609d2b9 + b32c8eb commit b8acb0f

File tree

5 files changed

+42
-5
lines changed

5 files changed

+42
-5
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Sync Stack To Date
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
7+
jobs:
8+
sync-stacktodate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Download stacktodate binary
12+
run: |
13+
VERSION="latest"
14+
curl -sL https://github.com/stacktodate/stacktodate-cli/releases/download/${VERSION}/stacktodate-linux-amd64 -o stacktodate
15+
chmod +x stacktodate
16+
17+
- name: Check stacktodate config
18+
run: ./stacktodate check
19+
20+
- name: Push stacktodate config
21+
run: ./stacktodate push
22+
env:
23+
STD_TOKEN: ${{ secrets.STD_TOKEN }}

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ jobs:
2626

2727
- name: Run tests
2828
run: go test -v ./...
29+
30+
- name: Build stacktodate
31+
run: go build -o stacktodate
32+
33+
- name: Check stacktodate config
34+
run: ./stacktodate check

cmd/check.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ var checkCmd = &cobra.Command{
4444
Short: "Check if detected versions match stacktodate.yml",
4545
Long: `Verify that the versions in stacktodate.yml match the currently detected versions in your project. Useful for CI/CD pipelines.`,
4646
Run: func(cmd *cobra.Command, args []string) {
47+
// Use default config file if not specified
48+
if checkConfigFile == "" {
49+
checkConfigFile = "stacktodate.yml"
50+
}
51+
4752
// Load config without requiring UUID
4853
config, err := helpers.LoadConfig(checkConfigFile)
4954
if err != nil {
@@ -53,11 +58,7 @@ var checkCmd = &cobra.Command{
5358
// Resolve absolute path for directory management
5459
absConfigPath, err := helpers.ResolveAbsPath(checkConfigFile)
5560
if err != nil {
56-
if checkConfigFile == "" {
57-
absConfigPath, _ = helpers.ResolveAbsPath("stacktodate.yml")
58-
} else {
59-
helpers.ExitOnError(err, "failed to resolve config path")
60-
}
61+
helpers.ExitOnError(err, "failed to resolve config path")
6162
}
6263

6364
// Get config directory

cmd/update.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ var updateCmd = &cobra.Command{
8787
var updateConfigFile string
8888

8989
func init() {
90+
rootCmd.AddCommand(updateCmd)
9091
// Flags for update command
9192
updateCmd.Flags().StringVarP(&updateConfigFile, "config", "c", "stacktodate.yml", "Path to stacktodate.yml config file (default: stacktodate.yml)")
9293
updateCmd.Flags().BoolVar(&skipAutodetect, "skip-autodetect", false, "Skip autodetection of project technologies")

stacktodate.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
uuid: 1fe0b376-1df7-4848-bf2d-525acdce6b82
2+
name: stacktodate-cli
3+
stack:
4+
go:
5+
version: "1.25"
6+
source: go.mod

0 commit comments

Comments
 (0)