Update .forgejo/workflows/CD.yml

This commit is contained in:
Matt Reeves 2024-07-30 20:37:04 -04:00
parent 7bca24ef86
commit 28e4391c85

View file

@ -6,7 +6,7 @@ on:
jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: docker
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
@ -85,13 +85,10 @@ jobs:
sleep 45 # Delay for 45 seconds before fetching logs
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')
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json)
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]+')
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" "https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json")
echo "AWX Job Logs for folder: $folder"
echo "Range:"
echo "Start: $(echo "$logs" | jq -r '.range.start')"
echo "End: $(echo "$logs" | jq -r '.range.end')"
echo "Absolute End: $(echo "$logs" | jq -r '.range.absolute_end')"
echo "Content:"
echo "$(echo "$logs" | jq -r '.content')"
done
echo "$logs" | grep -oP '"content":\s*"\K[^"]+' | sed 's/\\n/\n/g'
done