fix(ci): resolve nix-update workflow issues
- Remove --use-update-script flag that breaks with flake-only repos (nix-update-script expects default.nix at repo root) - Fix GitHub API jq filter for detecting prereleases - Fix Summary step bash syntax for handling input variables - Format lib/ files that were failing formatting check
This commit is contained in:
@@ -82,13 +82,13 @@ jobs:
|
|||||||
echo "::group::Checking $INPUT_NAME ($OWNER/$REPO)"
|
echo "::group::Checking $INPUT_NAME ($OWNER/$REPO)"
|
||||||
|
|
||||||
# Get latest stable release (exclude prereleases)
|
# Get latest stable release (exclude prereleases)
|
||||||
LATEST=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
# The /releases/latest endpoint already returns the latest non-prerelease, non-draft release
|
||||||
"https://api.github.com/repos/$OWNER/$REPO/releases/latest" | \
|
LATEST=$(curl -sf "https://api.github.com/repos/$OWNER/$REPO/releases/latest" | \
|
||||||
jq -r 'select(.prerelease == false) | .tag_name // empty')
|
jq -r 'if .prerelease == false then .tag_name else empty end')
|
||||||
|
|
||||||
if [ -z "$LATEST" ]; then
|
if [ -z "$LATEST" ]; then
|
||||||
echo "⚠️ No stable release found for $INPUT_NAME"
|
echo "⚠️ No stable release found for $INPUT_NAME (repo may only have prereleases)"
|
||||||
FAILED_INPUTS="$FAILED_INPUTS $INPUT_NAME(no-release)"
|
FAILED_INPUTS="$FAILED_INPUTS $INPUT_NAME(no-stable-release)"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@@ -175,13 +175,13 @@ jobs:
|
|||||||
nix eval .#${pkg}.passthru.updateScript --json >/dev/null 2>&1
|
nix eval .#${pkg}.passthru.updateScript --json >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
run_update() {
|
run_update() {
|
||||||
local pkg=$1
|
local pkg=$1
|
||||||
local before_hash=$(git rev-parse HEAD)
|
local before_hash=$(git rev-parse HEAD)
|
||||||
|
|
||||||
echo "::group::Updating $pkg"
|
echo "::group::Updating $pkg"
|
||||||
|
|
||||||
local args=("--flake" "--commit" "--use-github-releases" "--use-update-script")
|
local args=("--flake" "--commit" "--use-github-releases")
|
||||||
|
|
||||||
args+=("$pkg")
|
args+=("$pkg")
|
||||||
|
|
||||||
@@ -395,15 +395,19 @@ jobs:
|
|||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "## Updated Flake Inputs" >> $GITHUB_STEP_SUMMARY
|
echo "## Updated Flake Inputs" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
for input in ${{ steps.update-flake-inputs.outputs.updated_inputs }}; do
|
UPDATED_INPUTS="${{ steps.update-flake-inputs.outputs.updated_inputs }}"
|
||||||
echo "- **$input**" >> $GITHUB_STEP_SUMMARY
|
if [ -n "$UPDATED_INPUTS" ]; then
|
||||||
done
|
echo "$UPDATED_INPUTS" | tr ' ' '\n' | while read -r input; do
|
||||||
if [ -n "${{ steps.update-flake-inputs.outputs.failed_inputs }}" ]; then
|
[ -n "$input" ] && echo "- **$input**" >> $GITHUB_STEP_SUMMARY
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
FAILED_INPUTS="${{ steps.update-flake-inputs.outputs.failed_inputs }}"
|
||||||
|
if [ -n "$FAILED_INPUTS" ]; then
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "### Failed Inputs" >> $GITHUB_STEP_SUMMARY
|
echo "### Failed Inputs" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
for input in ${{ steps.update-flake-inputs.outputs.failed_inputs }}; do
|
echo "$FAILED_INPUTS" | tr ' ' '\n' | while read -r input; do
|
||||||
echo "- $input" >> $GITHUB_STEP_SUMMARY
|
[ -n "$input" ] && echo "- $input" >> $GITHUB_STEP_SUMMARY
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
# let
|
# let
|
||||||
# m3taLib = inputs.m3ta-nixpkgs.lib.${system};
|
# m3taLib = inputs.m3ta-nixpkgs.lib.${system};
|
||||||
# in ...
|
# in ...
|
||||||
{ lib }: {
|
{lib}: {
|
||||||
# Port management utilities
|
# Port management utilities
|
||||||
ports = import ./ports.nix { inherit lib; };
|
ports = import ./ports.nix {inherit lib;};
|
||||||
|
|
||||||
# OpenCode rules injection utilities
|
# OpenCode rules injection utilities
|
||||||
opencode-rules = import ./opencode-rules.nix { inherit lib; };
|
opencode-rules = import ./opencode-rules.nix {inherit lib;};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#
|
#
|
||||||
# The instructions list contains paths relative to the project root, all prefixed
|
# The instructions list contains paths relative to the project root, all prefixed
|
||||||
# with `.opencode-rules/`, making them portable across different project locations.
|
# with `.opencode-rules/`, making them portable across different project locations.
|
||||||
{ lib }: {
|
{lib}: {
|
||||||
# Create Opencode rules configuration from AGENTS repository
|
# Create Opencode rules configuration from AGENTS repository
|
||||||
#
|
#
|
||||||
# Args:
|
# Args:
|
||||||
@@ -69,42 +69,48 @@
|
|||||||
# # ".opencode-rules/frameworks/fastapi.md"
|
# # ".opencode-rules/frameworks/fastapi.md"
|
||||||
# # ];
|
# # ];
|
||||||
# # }
|
# # }
|
||||||
mkOpencodeRules = { agents, languages ? [ ], concerns ? [
|
mkOpencodeRules = {
|
||||||
"coding-style"
|
agents,
|
||||||
"naming"
|
languages ? [],
|
||||||
"documentation"
|
concerns ? [
|
||||||
"testing"
|
"coding-style"
|
||||||
"git-workflow"
|
"naming"
|
||||||
"project-structure"
|
"documentation"
|
||||||
], frameworks ? [ ], extraInstructions ? [ ] }:
|
"testing"
|
||||||
let
|
"git-workflow"
|
||||||
rulesDir = ".opencode-rules";
|
"project-structure"
|
||||||
|
],
|
||||||
|
frameworks ? [],
|
||||||
|
extraInstructions ? [],
|
||||||
|
}: let
|
||||||
|
rulesDir = ".opencode-rules";
|
||||||
|
|
||||||
# Build instructions list by mapping concerns, languages, frameworks to their file paths
|
# Build instructions list by mapping concerns, languages, frameworks to their file paths
|
||||||
# All paths are relative to project root via the rulesDir symlink
|
# All paths are relative to project root via the rulesDir symlink
|
||||||
instructions = (map (c: "${rulesDir}/concerns/${c}.md") concerns)
|
instructions =
|
||||||
++ (map (l: "${rulesDir}/languages/${l}.md") languages)
|
(map (c: "${rulesDir}/concerns/${c}.md") concerns)
|
||||||
++ (map (f: "${rulesDir}/frameworks/${f}.md") frameworks)
|
++ (map (l: "${rulesDir}/languages/${l}.md") languages)
|
||||||
++ extraInstructions;
|
++ (map (f: "${rulesDir}/frameworks/${f}.md") frameworks)
|
||||||
|
++ extraInstructions;
|
||||||
|
|
||||||
# Generate JSON configuration for Opencode
|
# Generate JSON configuration for Opencode
|
||||||
opencodeConfig = {
|
opencodeConfig = {
|
||||||
"$schema" = "https://opencode.ai/config.json";
|
"$schema" = "https://opencode.ai/config.json";
|
||||||
inherit instructions;
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
inherit instructions;
|
inherit instructions;
|
||||||
|
|
||||||
# Shell hook to set up rules in the project
|
|
||||||
# Creates a symlink to the AGENTS rules directory and generates opencode.json
|
|
||||||
shellHook = ''
|
|
||||||
# Create/update symlink to AGENTS rules directory
|
|
||||||
ln -sfn ${agents}/rules ${rulesDir}
|
|
||||||
|
|
||||||
# Generate opencode.json configuration file
|
|
||||||
cat > opencode.json <<'OPENCODE_EOF'
|
|
||||||
${builtins.toJSON opencodeConfig}
|
|
||||||
OPENCODE_EOF
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
in {
|
||||||
|
inherit instructions;
|
||||||
|
|
||||||
|
# Shell hook to set up rules in the project
|
||||||
|
# Creates a symlink to the AGENTS rules directory and generates opencode.json
|
||||||
|
shellHook = ''
|
||||||
|
# Create/update symlink to AGENTS rules directory
|
||||||
|
ln -sfn ${agents}/rules ${rulesDir}
|
||||||
|
|
||||||
|
# Generate opencode.json configuration file
|
||||||
|
cat > opencode.json <<'OPENCODE_EOF'
|
||||||
|
${builtins.toJSON opencodeConfig}
|
||||||
|
OPENCODE_EOF
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user