|
| 1 | +# Copyright 2026 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Generate Skills |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches-ignore: |
| 20 | + - main # main is kept up to date by PR merges; this bot targets PR branches |
| 21 | + |
| 22 | +concurrency: |
| 23 | + group: generate-skills-${{ github.ref }} |
| 24 | + cancel-in-progress: true |
| 25 | + |
| 26 | +env: |
| 27 | + CARGO_TERM_COLOR: always |
| 28 | + |
| 29 | +jobs: |
| 30 | + generate: |
| 31 | + name: Generate and commit skills |
| 32 | + runs-on: ubuntu-latest |
| 33 | + permissions: |
| 34 | + contents: write # needed to push the auto-commit |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + # Check out the PR head branch so we can push back to it. |
| 40 | + # For push events on a branch this is already the branch SHA. |
| 41 | + ref: ${{ github.head_ref || github.ref_name }} |
| 42 | + # Use the default GITHUB_TOKEN — it has write access to the same repo. |
| 43 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + |
| 45 | + - name: Install Rust |
| 46 | + uses: dtolnay/rust-toolchain@stable |
| 47 | + |
| 48 | + - name: Setup sccache |
| 49 | + uses: mozilla-actions/sccache-action@v0.0.7 |
| 50 | + |
| 51 | + - name: Cache cargo |
| 52 | + uses: Swatinem/rust-cache@v2 |
| 53 | + with: |
| 54 | + key: generate-skills-ubuntu |
| 55 | + |
| 56 | + - name: Generate skills |
| 57 | + run: cargo run -- generate-skills |
| 58 | + |
| 59 | + - name: Commit and push if changed |
| 60 | + run: | |
| 61 | + git config user.name "github-actions[bot]" |
| 62 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 63 | +
|
| 64 | + if git diff --quiet; then |
| 65 | + echo "No skill changes — nothing to commit." |
| 66 | + exit 0 |
| 67 | + fi |
| 68 | +
|
| 69 | + git add skills/ docs/skills.md |
| 70 | + git commit -m "chore: regenerate skills [skip ci]" |
| 71 | + git push |
0 commit comments