Skip to content

Commit cd20638

Browse files
committed
Separate steps for wishlist GitHub Action
1 parent cd7c323 commit cd20638

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

Diff for: .github/workflows/cron-wishlist.yml

+22-14
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,34 @@ jobs:
3333
uses: denoland/setup-deno@v1
3434
with:
3535
deno-version: ${{ env.DENO_VERSION }}
36-
37-
- name: Fetch and sync into reading list
36+
37+
- name: Fetch Kobo wishlist data
38+
id: fetch
39+
continue-on-error: true
3840
run: |
39-
output=$(deno run --allow-net --allow-read --allow-env ./script/fetch-kobo-wishlist.ts)
40-
ec=$?
41-
if [[ $ec -eq 0 && -n "$output" ]]; then
42-
echo "$output" >> "$reading_list"
43-
exit 0
44-
elif [[ $ec -eq 10 ]]; then
45-
echo "$output"
46-
exit 0 # Explicitly exit with success code
47-
else
48-
echo "Error: Unexpected exit code $ec"
49-
exit $ec # Pass through any unexpected error codes
50-
fi
41+
output=$(deno run --allow-net --allow-read --allow-env ./script/fetch-kobo-wishlist.ts)
42+
ec=$?
43+
echo "exit_code=$ec" >> $GITHUB_OUTPUT
44+
echo "output<<EOF" >> $GITHUB_OUTPUT
45+
echo "$output" >> $GITHUB_OUTPUT
46+
echo "EOF" >> $GITHUB_OUTPUT
5147
env:
5248
reading_list: ${{ env.READING_LIST_PATH }}
5349
KOBO_ACCESS_TOKEN: ${{ secrets.KOBO_ACCESS_TOKEN }}
5450
KOBO_REFRESH_TOKEN: ${{ secrets.KOBO_REFRESH_TOKEN }}
5551

52+
- name: Process results
53+
run: |
54+
if [[ ${{ steps.fetch.outputs.exit_code }} -eq 0 && -n "${{ steps.fetch.outputs.output }}" ]]; then
55+
echo "${{ steps.fetch.outputs.output }}" >> "${{ env.READING_LIST_PATH }}"
56+
echo "Successfully updated reading list"
57+
elif [[ ${{ steps.fetch.outputs.exit_code }} -eq 10 ]]; then
58+
echo "No new items to add. Output: ${{ steps.fetch.outputs.output }}"
59+
else
60+
echo "Error: Unexpected exit code ${{ steps.fetch.outputs.exit_code }}"
61+
exit 1
62+
fi
63+
5664
- name: Commit and push changed files
5765
# Pull first, since something could've been pushed in-between.
5866
run: |

0 commit comments

Comments
 (0)