Skip to content

Commit 2dc847c

Browse files
committed
ci: handle dataset PR creation safely
Constraint: Dataset automation may run before repository PR permissions are consistently available.\nRejected: Letting PR creation failure discard a successfully pushed dataset branch | it makes the daily job look broken even when data generation succeeded.\nConfidence: high\nScope-risk: narrow\nDirective: Keep PR creation best-effort and preserve generated batch branches for manual PR recovery.\nTested: workflow YAML parsed locally; python3 ai-core/tests/dataset_quality.py; python3 -m unittest tests/test_repository_validation.py.\nNot-tested: Live GitHub Actions PR creation after organization permission change.
1 parent 074a66c commit 2dc847c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/daily-dataset-batch.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,16 @@ jobs:
101101
if: steps.existing.outputs.skip != 'true'
102102
shell: bash
103103
run: |
104-
gh pr create \
104+
if gh pr view "${{ steps.meta.outputs.branch_name }}" --repo "${{ github.repository }}" >/dev/null 2>&1; then
105+
echo "Pull request already exists for ${{ steps.meta.outputs.branch_name }}"
106+
exit 0
107+
fi
108+
109+
if ! gh pr create \
105110
--base "${{ steps.meta.outputs.base_branch }}" \
106111
--head "${{ steps.meta.outputs.branch_name }}" \
107112
--title "data: daily dataset batch ${{ steps.meta.outputs.batch_date }}" \
108-
--body "Adds a generated CodeReferee dataset batch for ${{ steps.meta.outputs.batch_date }}.\n\nValidation run:\n- python3 ai-core/tests/dataset_quality.py\n- python3 -m unittest tests/test_repository_validation.py\n\nReview note: generated rows are candidates only and still require human semantic review before fine-tuning."
113+
--body "Adds a generated CodeReferee dataset batch for ${{ steps.meta.outputs.batch_date }}.\n\nValidation run:\n- python3 ai-core/tests/dataset_quality.py\n- python3 -m unittest tests/test_repository_validation.py\n\nReview note: generated rows are candidates only and still require human semantic review before fine-tuning."; then
114+
echo "::warning::Dataset branch was pushed, but this repository does not allow GitHub Actions to create pull requests. Enable Settings > Actions > General > Workflow permissions > Allow GitHub Actions to create and approve pull requests, or open the PR manually."
115+
echo "Branch: ${{ steps.meta.outputs.branch_name }}"
116+
fi

0 commit comments

Comments
 (0)