|
| 1 | +name: Check Kernel 6.12 Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: # Allow manual triggering |
| 5 | + |
| 6 | +jobs: |
| 7 | + check-kernel: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + |
| 10 | + steps: |
| 11 | + - name: Check out infix repository |
| 12 | + uses: actions/checkout@v4 |
| 13 | + with: |
| 14 | + fetch-depth: 0 |
| 15 | + token: ${{ secrets.KERNEL_UPDATE_TOKEN }} |
| 16 | + |
| 17 | + - name: Check out linux repository |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + repository: kernelkit/linux |
| 21 | + path: linux |
| 22 | + fetch-depth: 0 |
| 23 | + token: ${{ secrets.KERNEL_UPDATE_TOKEN }} |
| 24 | + |
| 25 | + - name: Fetch kernel.org and check for 6.12 release |
| 26 | + id: check |
| 27 | + run: | |
| 28 | + # Fetch the kernel.org frontpage and extract 6.12 version |
| 29 | + CURRENT_VERSION=$(curl -s https://www.kernel.org/ | grep -oP '6\.12\.\d+' | head -n1) |
| 30 | +
|
| 31 | + if [ -z "$CURRENT_VERSION" ]; then |
| 32 | + echo "Failed to fetch kernel version" |
| 33 | + exit 1 |
| 34 | + fi |
| 35 | +
|
| 36 | + echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT |
| 37 | + echo "Current 6.12 kernel version: $CURRENT_VERSION" |
| 38 | +
|
| 39 | + # Get the latest tag from our linux tree |
| 40 | + cd linux |
| 41 | + git fetch origin |
| 42 | + LATEST_TAG=$(git tag -l "v6.12.*" | sort -V | tail -n1 | sed 's/^v//') |
| 43 | + cd .. |
| 44 | +
|
| 45 | + echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT |
| 46 | + echo "Latest tag in our tree: $LATEST_TAG" |
| 47 | +
|
| 48 | + if [ "$CURRENT_VERSION" != "$LATEST_TAG" ]; then |
| 49 | + echo "new_release=true" >> $GITHUB_OUTPUT |
| 50 | + echo "🎉 New 6.12 kernel released: $CURRENT_VERSION (our version: $LATEST_TAG)" |
| 51 | + else |
| 52 | + echo "new_release=false" >> $GITHUB_OUTPUT |
| 53 | + echo "No change - still at $CURRENT_VERSION" |
| 54 | + fi |
| 55 | +
|
| 56 | + - name: Set up git credentials |
| 57 | + if: steps.check.outputs.new_release == 'true' |
| 58 | + run: | |
| 59 | + git config --global user.email "[email protected]" |
| 60 | + git config --global user.name "ael-bot" |
| 61 | +
|
| 62 | + # Configure git to use the token for HTTPS operations |
| 63 | + git config --global url."https://ael-bot:${{ secrets.KERNEL_UPDATE_TOKEN }}@github.com/".insteadOf "[email protected]:" |
| 64 | + git config --global url."https://ael-bot:${{ secrets.KERNEL_UPDATE_TOKEN }}@github.com/".insteadOf "https://github.com/" |
| 65 | +
|
| 66 | + - name: Run kernel upgrade script |
| 67 | + if: steps.check.outputs.new_release == 'true' |
| 68 | + env: |
| 69 | + GIT_TERMINAL_PROMPT: 0 |
| 70 | + run: | |
| 71 | + ./utils/kernel-upgrade.sh linux |
| 72 | +
|
| 73 | + - name: Create pull request |
| 74 | + if: steps.check.outputs.new_release == 'true' |
| 75 | + uses: actions/github-script@v7 |
| 76 | + with: |
| 77 | + github-token: ${{ secrets.KERNEL_UPDATE_TOKEN }} |
| 78 | + script: | |
| 79 | + // Check if PR already exists |
| 80 | + const { data: pulls } = await github.rest.pulls.list({ |
| 81 | + owner: context.repo.owner, |
| 82 | + repo: context.repo.repo, |
| 83 | + head: `${context.repo.owner}:kernel-upgrade`, |
| 84 | + state: 'open' |
| 85 | + }); |
| 86 | +
|
| 87 | + if (pulls.length === 0) { |
| 88 | + const { data: pr } = await github.rest.pulls.create({ |
| 89 | + owner: context.repo.owner, |
| 90 | + repo: context.repo.repo, |
| 91 | + title: `Upgrade to kernel ${{ steps.check.outputs.current_version }}`, |
| 92 | + head: 'kernel-upgrade', |
| 93 | + base: 'main', |
| 94 | + body: `Automated kernel upgrade to version ${{ steps.check.outputs.current_version }}.\n\n**Previous version:** ${{ steps.check.outputs.latest_tag }}\n**New version:** ${{ steps.check.outputs.current_version }}\n**Source:** https://www.kernel.org/\n\nThis PR was automatically created by the kernel release monitoring workflow.` |
| 95 | + }); |
| 96 | +
|
| 97 | + // Add label |
| 98 | + await github.rest.issues.addLabels({ |
| 99 | + owner: context.repo.owner, |
| 100 | + repo: context.repo.repo, |
| 101 | + issue_number: pr.number, |
| 102 | + labels: ['ci:main'] |
| 103 | + }); |
| 104 | +
|
| 105 | + // Request reviews |
| 106 | + await github.rest.pulls.requestReviewers({ |
| 107 | + owner: context.repo.owner, |
| 108 | + repo: context.repo.repo, |
| 109 | + pull_number: pr.number, |
| 110 | + reviewers: ['troglobit', 'wkz', 'mattiaswal'] |
| 111 | + }); |
| 112 | + } |
0 commit comments