summaryrefslogtreecommitdiffstats
path: root/.github/workflows/llm-review.yml
blob: 5a5b233bae97d2a2ff844a5ee33451a5e621eda3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: LLM Review

on:
  schedule:
    - cron: '0 3,15 * * *'
  workflow_dispatch:
    inputs:
      max_prs:
        description: 'Max PRs to review in this nightly run'
        required: false
        type: number
        default: 24

permissions: {}

concurrency:
  group: ${{ github.workflow }}-nightly
  cancel-in-progress: false

jobs:
  detect-kernels:
    name: Detect kernel versions for extra_repos
    if: github.repository_owner == 'openwrt'
    runs-on: ubuntu-slim
    permissions:
      contents: read
    outputs:
      extra_repos: ${{ steps.detect.outputs.extra_repos }}
    steps:
      - name: Checkout kernel version files
        uses: actions/checkout@v6
        with:
          sparse-checkout: target/linux/generic

      - name: Build extra_repos list
        id: detect
        run: |
          set -euo pipefail
          tags=()

          # Linux stable tree, one tag per kernel-* version file.
          for f in target/linux/generic/kernel-*; do
            [ -f "$f" ] || continue
            major=$(basename "$f" | sed 's/^kernel-//')
            patch=$(awk -v k="LINUX_VERSION-$major" '$1==k{print $3; exit}' "$f")
            [ -z "$patch" ] && continue
            tags+=("gregkh/linux:v${major}${patch}")
          done

          # U-Boot upstream tracked at master.
          tags+=("u-boot/u-boot:master")

          # Other upstream/userspace projects whose code OpenWrt PRs
          # often touch — included as available references; the
          # routine clones each only when relevant to the diff.
          tags+=("https://thekelleys.org.uk/git/dnsmasq.git:master")
          tags+=("https://git.w1.fi/hostap.git:main")
          tags+=("mkj/dropbear:master")
          tags+=("jow-/ucode:master")
          tags+=("openwrt/netifd:master")
          tags+=("openwrt/procd:main")

          extra=$(IFS=,; echo "${tags[*]:-}")
          echo "Computed extra_repos: $extra"
          echo "extra_repos=$extra" >> "$GITHUB_OUTPUT"

  nightly:
    if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.repository_owner == 'openwrt'
    needs: detect-kernels
    permissions:
      pull-requests: read
    uses: openwrt/actions-shared-workflows/.github/workflows/reusable_llm-nightly-digest.yml@main
    with:
      routine_id: ${{ vars.LLM_ROUTINE_ID_NIGHTLY }}
      extra_repos: ${{ needs.detect-kernels.outputs.extra_repos }}
      max_prs: ${{ fromJSON(inputs.max_prs || '24') }}
    secrets:
      llm_routine_token: ${{ secrets.LLM_ROUTINE_TOKEN_NIGHTLY }}