|
| 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 | + pull_request: |
| 19 | + paths: |
| 20 | + - "toolbox_version.txt" |
| 21 | + |
| 22 | +jobs: |
| 23 | + generate-skills: |
| 24 | + # Only run for same-repo PRs (e.g. renovate's toolbox bump), where the |
| 25 | + # built-in GITHUB_TOKEN can push back to the PR branch. |
| 26 | + if: github.event.pull_request.head.repo.full_name == github.repository |
| 27 | + runs-on: ubuntu-latest |
| 28 | + permissions: |
| 29 | + contents: write |
| 30 | + steps: |
| 31 | + - name: Check out PR branch |
| 32 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 33 | + with: |
| 34 | + ref: ${{ github.head_ref }} |
| 35 | + |
| 36 | + - name: Generate skills |
| 37 | + run: | |
| 38 | + VERSION="$(tr -d '\n' < toolbox_version.txt)" |
| 39 | + echo "Detected toolbox version: $VERSION" |
| 40 | + export VERSION |
| 41 | + chmod +x ./.github/scripts/generate_skills.sh |
| 42 | + ./.github/scripts/generate_skills.sh |
| 43 | +
|
| 44 | + - name: Commit and push regenerated skills |
| 45 | + run: | |
| 46 | + if [ -z "$(git status --porcelain)" ]; then |
| 47 | + echo "No skill changes generated. Nothing to commit." |
| 48 | + exit 0 |
| 49 | + fi |
| 50 | +
|
| 51 | + echo "Changes detected. Committing regenerated skills..." |
| 52 | + git config user.name "github-actions[bot]" |
| 53 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 54 | + git add . |
| 55 | + git commit -m "chore: auto-generate skills for toolbox v$(tr -d '\n' < toolbox_version.txt)" |
| 56 | + git push |
0 commit comments