Compare commits

..

3 Commits

Author SHA1 Message Date
Carlos Polop
be1b0cdbd0 f 2026-01-19 01:27:47 +01:00
Carlos Polop
4308caddf1 Fix PR context parsing in failure dispatch 2026-01-19 00:10:42 +01:00
SirBroccoli
54fc62d29b Auto-merge PR #552 (Codex) 2026-01-18 23:06:21 +00:00
3 changed files with 41 additions and 32 deletions

View File

@@ -10,7 +10,7 @@ jobs:
if: >
${{ github.event.workflow_run.conclusion == 'failure' &&
github.event.workflow_run.pull_requests &&
github.event.workflow_run.pull_requests[0].user.login == 'carlospolop' &&
github.event.workflow_run.pull_requests[0] &&
!startsWith(github.event.workflow_run.head_commit.message, 'Fix CI failures for PR #') }}
runs-on: ubuntu-latest
permissions:
@@ -20,10 +20,33 @@ jobs:
actions: read
steps:
- name: Comment on PR with failure info
uses: actions/github-script@v7
- name: Resolve PR context
id: pr_context
env:
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
GH_TOKEN: ${{ github.token }}
run: |
pr_author=$(gh api -H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/pulls/${PR_NUMBER} \
--jq '.user.login')
pr_head_repo=$(gh api -H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/pulls/${PR_NUMBER} \
--jq '.head.repo.full_name')
pr_head_branch=$(gh api -H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/pulls/${PR_NUMBER} \
--jq '.head.ref')
{
echo "number=${PR_NUMBER}"
echo "author=${pr_author}"
echo "head_repo=${pr_head_repo}"
echo "head_branch=${pr_head_branch}"
} >> "$GITHUB_OUTPUT"
- name: Comment on PR with failure info
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
uses: actions/github-script@v7
env:
PR_NUMBER: ${{ steps.pr_context.outputs.number }}
RUN_URL: ${{ github.event.workflow_run.html_url }}
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
with:
@@ -39,19 +62,22 @@ jobs:
});
- name: Checkout PR head
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
uses: actions/checkout@v5
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
repository: ${{ steps.pr_context.outputs.head_repo }}
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
persist-credentials: true
- name: Configure git author
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
run: |
git config user.name "codex-action"
git config user.email "codex-action@users.noreply.github.com"
- name: Fetch failure summary
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
env:
GH_TOKEN: ${{ github.token }}
RUN_ID: ${{ github.event.workflow_run.id }}
@@ -79,10 +105,11 @@ jobs:
PY
- name: Create Codex prompt
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
env:
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
PR_NUMBER: ${{ steps.pr_context.outputs.number }}
RUN_URL: ${{ github.event.workflow_run.html_url }}
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
HEAD_BRANCH: ${{ steps.pr_context.outputs.head_branch }}
run: |
{
echo "You are fixing CI failures for PR #${PR_NUMBER} in ${{ github.repository }}."
@@ -98,6 +125,7 @@ jobs:
} > codex_prompt.txt
- name: Run Codex
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
id: run_codex
uses: openai/codex-action@v1
with:
@@ -107,23 +135,26 @@ jobs:
model: gpt-5.2-codex
- name: Commit and push if changed
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
env:
TARGET_BRANCH: ${{ github.event.workflow_run.head_branch }}
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
TARGET_BRANCH: ${{ steps.pr_context.outputs.head_branch }}
PR_NUMBER: ${{ steps.pr_context.outputs.number }}
run: |
if git diff --quiet; then
echo "No changes to commit."
exit 0
fi
rm -f codex_failure_summary.txt codex_prompt.txt
git add -A
git reset -- codex_failure_summary.txt codex_prompt.txt
git commit -m "Fix CI failures for PR #${PR_NUMBER}"
git push origin HEAD:${TARGET_BRANCH}
- name: Comment with Codex result
if: steps.run_codex.outputs.final-message != ''
if: ${{ steps.pr_context.outputs.author == 'carlospolop' && steps.run_codex.outputs.final-message != '' }}
uses: actions/github-script@v7
env:
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
PR_NUMBER: ${{ steps.pr_context.outputs.number }}
CODEX_MESSAGE: ${{ steps.run_codex.outputs.final-message }}
with:
github-token: ${{ github.token }}

View File

@@ -1,7 +0,0 @@
Job: Build_and_test_linpeas_pr (id 60731895947)
URL: https://github.com/peass-ng/PEASS-ng/actions/runs/21120092167/job/60731895947
Step: Build linpeas
Job: Build_and_test_macpeas_pr (id 60731895952)
URL: https://github.com/peass-ng/PEASS-ng/actions/runs/21120092167/job/60731895952
Step: Build macpeas

View File

@@ -1,15 +0,0 @@
You are fixing CI failures for PR #551 in peass-ng/PEASS-ng.
The failing workflow run is: https://github.com/peass-ng/PEASS-ng/actions/runs/21120092167
The PR branch is: codex-pr-failure-test-1
Failure summary:
Job: Build_and_test_linpeas_pr (id 60731895947)
URL: https://github.com/peass-ng/PEASS-ng/actions/runs/21120092167/job/60731895947
Step: Build linpeas
Job: Build_and_test_macpeas_pr (id 60731895952)
URL: https://github.com/peass-ng/PEASS-ng/actions/runs/21120092167/job/60731895952
Step: Build macpeas
Please identify the cause, apply a easy, simple and minimal fix, and update files accordingly.
Run any fast checks you can locally (no network).
Leave the repo in a state ready to commit as when you finish, it'll be automatically committed and pushed.