Skip to content

Commit 35f3777

Browse files
authored
Update configlet-sync.yml
1 parent fe71fa3 commit 35f3777

1 file changed

Lines changed: 9 additions & 21 deletions

File tree

.github/workflows/configlet-sync.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ jobs:
2828
title: "🤖 Configlet sync: docs, metadata, and filepaths"
2929
body: |
3030
This PR was generated automatically by a scheduled workflow.
31-
3231
It includes updates from `configlet sync` for:
3332
- 📄 Documentation
3433
- 🧭 Metadata
3534
- 🗂️ Filepaths
36-
3735
Please review and merge if everything looks good!
3836
branch: configlet-auto-sync
3937
delete-branch: true
@@ -52,19 +50,11 @@ jobs:
5250
- name: Run configlet sync for test and capture output
5351
id: sync_test
5452
run: |
55-
configlet_raw_output="$(./bin/configlet sync --tests | tee .github/sync-test-output.txt)"
56-
57-
echo "configlet output:"
58-
echo "$configlet_raw_output"
59-
60-
echo '```' > .github/sync-test-output.txt
61-
echo "$configlet_raw_output" >> .github/sync-test-output.txt
62-
echo '```' >> .github/sync-test-output.txt
63-
64-
echo "output<<EOF" >> "$GITHUB_OUTPUT"
65-
echo "$configlet_raw_output" >> "$GITHUB_OUTPUT"
66-
echo "EOF" >> "$GITHUB_OUTPUT"
67-
53+
configlet_raw_output="$(./bin/configlet sync --tests)"
54+
printf "configlet output:\n%s\n" "$configlet_raw_output"
55+
mkdir -p temp
56+
printf '```\n%s\n```\n' "$configlet_raw_output" > temp/sync-test-output.txt
57+
printf 'output<<EOF\n%s\nEOF\n' "$configlet_raw_output" > "$GITHUB_OUTPUT"
6858
- name: Find existing issue for test sync
6959
id: find_issue
7060
if: ${{ !contains(steps.sync_test.outputs.output, 'Every exercise has up-to-date tests!') }}
@@ -73,21 +63,19 @@ jobs:
7363
run: |
7464
ISSUE_TITLE="🚨 configlet sync --test found unsynced tests"
7565
ISSUE_DATA=$(gh issue list --search "is:issue is:open in:title \"${ISSUE_TITLE}\" repo:${{ github.repository }}" --json number,title --jq '.[0]')
76-
77-
if [ -z "$ISSUE_DATA" ]; then
78-
echo "No open issue found with title: '${ISSUE_TITLE}'. A new one will be created."
66+
if [[ -z "$ISSUE_DATA" ]]; then
67+
printf "No open issue found with title: '%s'. A new one will be created.\n" "${ISSUE_TITLE}"
7968
echo "issue_number=" >> $GITHUB_OUTPUT
8069
else
81-
ISSUE_NUMBER=$(echo "$ISSUE_DATA" | jq -r '.number')
70+
ISSUE_NUMBER=$(jq -r '.number' <<< "$ISSUE_DATA")
8271
echo "Found existing issue number: $ISSUE_NUMBER for title: '$ISSUE_TITLE'"
8372
echo "issue_number=$ISSUE_NUMBER" >> $GITHUB_OUTPUT
8473
fi
85-
8674
- name: Create or Update issue if tests are not synced
8775
if: ${{ !contains(steps.sync_test.outputs.output, 'Every exercise has up-to-date tests!') }}
8876
uses: peter-evans/create-issue-from-file@v5
8977
with:
9078
token: ${{ secrets.GITHUB_TOKEN }}
9179
title: "🚨 configlet sync --test found unsynced tests"
92-
content-filepath: .github/sync-test-output.txt
80+
content-filepath: temp/sync-test-output.txt
9381
issue-number: ${{ steps.find_issue.outputs.issue_number || '' }}

0 commit comments

Comments
 (0)