-
Notifications
You must be signed in to change notification settings - Fork 1.6k
119 lines (102 loc) · 3.98 KB
/
Copy pathgenerate-skills.yml
File metadata and controls
119 lines (102 loc) · 3.98 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Generate Skills
on:
schedule:
- cron: "0 * * * *" # Hourly — keeps skills in sync with Discovery API changes
workflow_dispatch: # Manual trigger
push:
branches-ignore:
- main # main is kept up to date by PR merges
concurrency:
group: generate-skills-${{ github.ref_name }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
generate:
name: Generate and commit skills
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
# For cron/dispatch: check out main. For push: check out the branch.
ref: ${{ github.head_ref || github.ref_name }}
token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
- name: Install Rust
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
- name: Setup sccache
uses: mozilla-actions/sccache-action@2df7dbab909c49ab7d3382d05da469f3f975c2d6 # v0.0.7
- name: Cache cargo
uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2
with:
key: generate-skills-ubuntu
- name: Generate skills
run: cargo run -- generate-skills
- name: Check for changes
id: diff
run: |
if git diff --quiet skills/ docs/skills.md; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
# --- Cron / workflow_dispatch: open a PR against main ---
- name: Create changeset for sync PR
if: >-
steps.diff.outputs.changed == 'true' &&
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
run: |
mkdir -p .changeset
cat > .changeset/sync-skills.md << 'EOF'
---
"@googleworkspace/cli": patch
---
Sync generated skills with latest Google Discovery API specs
EOF
- name: Create or update sync PR
if: >-
steps.diff.outputs.changed == 'true' &&
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7
with:
token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
branch: chore/sync-skills
title: "chore: sync skills with Discovery API"
body: |
Automated PR — the Google Discovery API specs have changed and the
generated skill files are out of date.
Created by the **Generate Skills** workflow (`generate-skills.yml`).
commit-message: "chore: regenerate skills from Discovery API"
add-paths: |
skills/
docs/skills.md
.changeset/sync-skills.md
delete-branch: true
# --- Push events (non-main branches): commit directly ---
- name: Commit and push if changed
if: >-
steps.diff.outputs.changed == 'true' &&
github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
run: |
git config user.name "googleworkspace-bot"
git config user.email "googleworkspace-bot@users.noreply.github.com"
git add skills/ docs/skills.md
git commit -m "chore: regenerate skills [skip ci]"
git push