Skip to content

Commit 4fb009e

Browse files
committed
fix: resolve update-metadata workflow failures
- Fix bash syntax error in multiline processing by using proper while read loop - Replace fragile grep/sed with yq for reliable YAML parsing - Correct field name from lastupdated to last_updated to match spec files - Add proper error handling and fallback for missing metadata fields Fixes the consistently failing update-metadata.yml workflow that was encountering syntax errors when processing GitHub Actions multiline output.
1 parent 52af767 commit 4fb009e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/update-metadata.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ jobs:
5151
TEMP_FILE=$(mktemp)
5252
5353
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")
54+
# Extract last_updated field using yq, default to epoch if not found
55+
LAST_UPDATED=$(yq eval '.metadata.last_updated // "1970-01-01T00:00:00Z"' "$spec" 2>/dev/null || echo "1970-01-01T00:00:00Z")
56+
# Remove quotes if present
57+
LAST_UPDATED=$(echo "$LAST_UPDATED" | tr -d '"')
5658
echo "$LAST_UPDATED $spec" >> "$TEMP_FILE"
5759
done
5860
@@ -75,8 +77,7 @@ jobs:
7577
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7678
run: |
7779
# Update each spec file
78-
IFS=$'\n'
79-
for spec in ${{ steps.get-entries.outputs.specs }}; do
80+
echo '${{ steps.get-entries.outputs.specs }}' | while IFS= read -r spec; do
8081
if [ -n "$spec" ]; then
8182
echo "Updating metadata for $spec"
8283
./regup "$spec" || echo "Warning: Failed to update $spec"

0 commit comments

Comments
 (0)