|
| 1 | +name: changed-scope-quality-weekly |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '45 3 * * 1' |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + feedback_jsonl_path: |
| 9 | + description: 'Custom feedback JSONL path (optional)' |
| 10 | + required: false |
| 11 | + type: string |
| 12 | + default: '' |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - main |
| 16 | + paths: |
| 17 | + - 'scripts/report_changed_scope_quality.py' |
| 18 | + - 'configs/changed_scope/rule_tuning.json' |
| 19 | + - 'tests/fixtures/changed_scope/changed-scope-feedback.schema.json' |
| 20 | + - 'tests/fixtures/changed_scope/changed-scope-feedback.sample.jsonl' |
| 21 | + - '.github/workflows/changed-scope-quality-weekly.yml' |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: read |
| 25 | + |
| 26 | +jobs: |
| 27 | + changed-scope-quality: |
| 28 | + runs-on: ubuntu-24.04 |
| 29 | + permissions: |
| 30 | + contents: read |
| 31 | + actions: write |
| 32 | + steps: |
| 33 | + - name: Initialize Runner Tool Cache Env |
| 34 | + run: | |
| 35 | + echo "AGENT_TOOLSDIRECTORY=${RUNNER_TEMP}/hostedtoolcache-${GITHUB_JOB}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> "${GITHUB_ENV}" |
| 36 | + echo "RUNNER_TOOL_CACHE=${RUNNER_TEMP}/hostedtoolcache-${GITHUB_JOB}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> "${GITHUB_ENV}" |
| 37 | +
|
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 40 | + with: |
| 41 | + fetch-depth: 0 |
| 42 | + persist-credentials: false |
| 43 | + clean: true |
| 44 | + |
| 45 | + - name: Prepare input |
| 46 | + id: prep |
| 47 | + env: |
| 48 | + CUSTOM_INPUT: ${{ github.event.inputs.feedback_jsonl_path || '' }} |
| 49 | + run: | |
| 50 | + set -euo pipefail |
| 51 | + mkdir -p .runtime-cache/test_output/changed_scope_quality/input |
| 52 | + custom_input="${CUSTOM_INPUT}" |
| 53 | + default_input=".runtime-cache/test_output/changed_scope/feedback.jsonl" |
| 54 | + input_path="${default_input}" |
| 55 | + if [[ -n "${custom_input}" ]]; then |
| 56 | + input_path="${custom_input}" |
| 57 | + fi |
| 58 | + if [[ ! -f "${input_path}" ]]; then |
| 59 | + input_path=".runtime-cache/test_output/changed_scope_quality/input/feedback.sample.jsonl" |
| 60 | + cp tests/fixtures/changed_scope/changed-scope-feedback.sample.jsonl "${input_path}" |
| 61 | + echo "[changed-scope-quality] feedback input missing, fallback to sample dataset" |
| 62 | + sample_fallback_used="1" |
| 63 | + else |
| 64 | + sample_fallback_used="0" |
| 65 | + fi |
| 66 | + { |
| 67 | + echo "sample_fallback_used=${sample_fallback_used}" |
| 68 | + echo "input_path=${input_path}" |
| 69 | + } >> "${GITHUB_OUTPUT}" |
| 70 | +
|
| 71 | + - name: Generate changed-scope quality report via docker_ci lane |
| 72 | + env: |
| 73 | + INPUT_PATH: ${{ steps.prep.outputs.input_path }} |
| 74 | + run: | |
| 75 | + set -euo pipefail |
| 76 | + bash scripts/docker_ci.sh lane changed-scope-quality \ |
| 77 | + --input-jsonl "${INPUT_PATH}" \ |
| 78 | + --output-dir ".runtime-cache/test_output/changed_scope_quality" \ |
| 79 | + --base-config "configs/changed_scope/rule_tuning.json" |
| 80 | +
|
| 81 | + - name: Publish summary |
| 82 | + if: always() |
| 83 | + env: |
| 84 | + RUN_ID: ${{ github.run_id }} |
| 85 | + INPUT_PATH: ${{ steps.prep.outputs.input_path }} |
| 86 | + SAMPLE_FALLBACK_USED: ${{ steps.prep.outputs.sample_fallback_used }} |
| 87 | + run: | |
| 88 | + set -euo pipefail |
| 89 | + latest_week="$(find .runtime-cache/test_output/changed_scope_quality -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort | tail -n 1)" |
| 90 | + summary_md=".runtime-cache/test_output/changed_scope_quality/${latest_week}/changed_scope_quality.summary.md" |
| 91 | + if [[ -f "${summary_md}" ]]; then |
| 92 | + { |
| 93 | + echo "## changed-scope-quality-weekly" |
| 94 | + echo "- run_id: ${RUN_ID}" |
| 95 | + echo "- input: \`${INPUT_PATH}\`" |
| 96 | + echo "- sample_fallback_used: \`${SAMPLE_FALLBACK_USED}\`" |
| 97 | + echo "" |
| 98 | + cat "${summary_md}" |
| 99 | + } >> "${GITHUB_STEP_SUMMARY}" |
| 100 | + fi |
| 101 | +
|
| 102 | + - name: Emit truth-mode marker |
| 103 | + if: always() |
| 104 | + env: |
| 105 | + SAMPLE_FALLBACK_USED: ${{ steps.prep.outputs.sample_fallback_used }} |
| 106 | + run: | |
| 107 | + set -euo pipefail |
| 108 | + mkdir -p .runtime-cache/test_output/changed_scope_quality/meta |
| 109 | + if [[ "${SAMPLE_FALLBACK_USED}" == "1" ]]; then |
| 110 | + sample_fallback_used=true |
| 111 | + else |
| 112 | + sample_fallback_used=false |
| 113 | + fi |
| 114 | + cat > .runtime-cache/test_output/changed_scope_quality/meta/truth_status.json <<EOF |
| 115 | + { |
| 116 | + "report_type": "cortexpilot_changed_scope_truth_status", |
| 117 | + "sample_fallback_used": ${sample_fallback_used}, |
| 118 | + "analytics_only": true, |
| 119 | + "blocking_quality_gate": false, |
| 120 | + "release_truth_eligible": false |
| 121 | + } |
| 122 | + EOF |
| 123 | +
|
| 124 | + - name: Upload changed-scope quality artifacts |
| 125 | + if: always() |
| 126 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 |
| 127 | + with: |
| 128 | + name: changed-scope-quality-weekly-${{ github.run_id }} |
| 129 | + retention-days: 14 |
| 130 | + if-no-files-found: warn |
| 131 | + path: | |
| 132 | + .runtime-cache/test_output/changed_scope_quality/** |
0 commit comments