mirror of
https://github.com/nubenetes/awesome-kubernetes.git
synced 2026-07-13 02:10:15 +00:00
feat(workflow): add run-attempt caching, PR creation resilience, and fallback triage issue creation
This commit is contained in:
@@ -51,6 +51,17 @@ jobs:
|
||||
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
||||
run: playwright install chromium --with-deps
|
||||
|
||||
- name: Restore Link Checker Cache
|
||||
uses: actions/cache/restore@v4
|
||||
id: link-checker-cache
|
||||
with:
|
||||
path: |
|
||||
shard_result.json
|
||||
triage_report.md
|
||||
key: link-cleaner-results-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
restore-keys: |
|
||||
link-cleaner-results-${{ github.run_id }}-
|
||||
|
||||
- name: Global Intelligent Cleaning Execution (Sequential Fast-Track)
|
||||
env:
|
||||
GEMINI_API_KEY_1: ${{ secrets.GEMINI_API_KEY_1 }}
|
||||
@@ -60,7 +71,11 @@ jobs:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
PYTHONUNBUFFERED: 1
|
||||
run: |
|
||||
python src/intelligent_health_checker.py
|
||||
if [ -f shard_result.json ]; then
|
||||
echo "shard_result.json found in cache/restored files. Skipping health checker execution."
|
||||
else
|
||||
python src/intelligent_health_checker.py
|
||||
fi
|
||||
|
||||
- name: Run Inventory Reducer & Apply Changes
|
||||
env:
|
||||
@@ -79,9 +94,23 @@ jobs:
|
||||
EXISTING_ISSUE=$(gh issue list --search "$ISSUE_TITLE" --state open --json number --jq '.[0].number')
|
||||
|
||||
if [ -z "$EXISTING_ISSUE" ]; then
|
||||
gh issue create --title "$ISSUE_TITLE" --body-file triage_report.md --label "triage, automated-report"
|
||||
gh issue create --title "$ISSUE_TITLE" --body-file triage_report.md --label "triage, automated-report" || gh issue create --title "$ISSUE_TITLE" --body-file triage_report.md
|
||||
else
|
||||
echo "A triage issue already exists (#$EXISTING_ISSUE). Updating with new report..."
|
||||
gh issue comment $EXISTING_ISSUE --body-file triage_report.md
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Ensure Cache Files Exist
|
||||
if: always()
|
||||
run: |
|
||||
touch shard_result.json triage_report.md
|
||||
|
||||
- name: Save Link Checker Cache
|
||||
if: always()
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
shard_result.json
|
||||
triage_report.md
|
||||
key: link-cleaner-results-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
|
||||
@@ -151,12 +151,24 @@ class RepositoryController:
|
||||
|
||||
pr_body += f"{ai_intel}\n\n{mermaid}\n{source_md}\n{gems_md}\n---\n**Audit Matrix and Logs follow in successive comments.**\n"
|
||||
|
||||
pr = self.repository.create_pull(
|
||||
title=f"💎 Knowledge Update & Optimization: {datetime.now().strftime('%d %b %Y')}",
|
||||
body=pr_body[:65000],
|
||||
head=branch_name,
|
||||
base=self.default_branch_name
|
||||
)
|
||||
try:
|
||||
pr = self.repository.create_pull(
|
||||
title=f"💎 Knowledge Update & Optimization: {datetime.now().strftime('%d %b %Y')}",
|
||||
body=pr_body[:65000],
|
||||
head=branch_name,
|
||||
base=self.default_branch_name
|
||||
)
|
||||
except Exception as e:
|
||||
if "pull request already exists" in str(e).lower() or "422" in str(e):
|
||||
print(f"[INFO] Pull request already exists for branch {branch_name}. Fetching existing one...")
|
||||
pulls = self.repository.get_pulls(state='open', head=f"{self.repository.owner.login}:{branch_name}")
|
||||
if pulls.totalCount > 0:
|
||||
pr = pulls[0]
|
||||
pr.edit(body=pr_body[:65000])
|
||||
else:
|
||||
raise e
|
||||
else:
|
||||
raise e
|
||||
|
||||
# 1. Safety Report (if huge)
|
||||
if not safety_in_body:
|
||||
|
||||
Reference in New Issue
Block a user