Skip to content

Commit a386b35

Browse files
author
mafyuh
committedJul 31, 2024
Update .forgejo/workflows/CD.yml
1 parent 93d3c9f commit a386b35

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed
 

‎.forgejo/workflows/CD.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
- name: Fetch all history for git diff
1515
run: git fetch --depth=2
1616

17+
- name: Install jq
18+
run: |
19+
apt-get update && apt-get install -y jq
20+
1721
- name: Detect modified folders
1822
id: detect-changes
1923
run: |
@@ -85,10 +89,13 @@ jobs:
8589
8690
sleep 45 # Delay for 45 seconds before fetching logs
8791
88-
job_id=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" "https://awx.mafyuh.xyz/api/v2/job_templates/13/jobs/?order_by=-id" | grep -oP '"id":\s*\K[0-9]+')
89-
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" "https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json")
90-
92+
job_id=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/job_templates/13/jobs/?order_by=-id | jq -r '.results[0].id')
93+
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json)
9194
echo "AWX Job Logs for folder: $folder"
95+
echo "Range:"
96+
echo "Start: $(echo "$logs" | jq -r '.range.start')"
97+
echo "End: $(echo "$logs" | jq -r '.range.end')"
98+
echo "Absolute End: $(echo "$logs" | jq -r '.range.absolute_end')"
9299
echo "Content:"
93-
echo "$logs" | grep -oP '"content":\s*"\K[^"]+' | sed 's/\\n/\n/g'
100+
echo "$(echo "$logs" | jq -r '.content')"
94101
done

0 commit comments

Comments
 (0)
Please sign in to comment.