From d39f29e20c28b98de42b040a8c27c6c01c10d94e Mon Sep 17 00:00:00 2001 From: mafyuh Date: Mon, 10 Jun 2024 00:36:33 +0000 Subject: [PATCH] Add .forgejo/workflows/get-logs.yml --- .forgejo/workflows/get-logs.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .forgejo/workflows/get-logs.yml diff --git a/.forgejo/workflows/get-logs.yml b/.forgejo/workflows/get-logs.yml new file mode 100644 index 0000000..5568ac1 --- /dev/null +++ b/.forgejo/workflows/get-logs.yml @@ -0,0 +1,18 @@ +--- +name: Get AWX Job Logs +on: + workflow_call: + inputs: + name: get-logs-trigger + +jobs: + fetch-logs: + runs-on: docker + steps: + - name: Get AWX Job Logs + run: | + # Fetch the most recent job from AWX + 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') + + # Fetch the logs for the job + curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/