@@ -33,26 +33,34 @@ jobs:
33
33
uses : denoland/setup-deno@v1
34
34
with :
35
35
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
38
40
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
51
47
env :
52
48
reading_list : ${{ env.READING_LIST_PATH }}
53
49
KOBO_ACCESS_TOKEN : ${{ secrets.KOBO_ACCESS_TOKEN }}
54
50
KOBO_REFRESH_TOKEN : ${{ secrets.KOBO_REFRESH_TOKEN }}
55
51
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
+
56
64
- name : Commit and push changed files
57
65
# Pull first, since something could've been pushed in-between.
58
66
run : |
0 commit comments