feat: Implement hourly cron and manual trigger for the generate-skills workflow to auto-sync skills via pull requests and downgrade CI drift check to a warning. (#63)
* feat: Implement hourly cron and manual trigger for the generate-skills workflow to auto-sync skills via pull requests and downgrade CI drift check to a warning. * chore: regenerate skills [skip ci] --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@googleworkspace/cli": patch
|
||||
---
|
||||
|
||||
Add hourly cron to generate-skills workflow to auto-sync skills with upstream Google Discovery API changes via PR
|
||||
@@ -127,8 +127,7 @@ jobs:
|
||||
- name: Check for drift
|
||||
run: |
|
||||
if ! git diff --exit-code skills/; then
|
||||
echo "::error::Skills are out of date. Run 'cargo run -- generate-skills' and commit the changes."
|
||||
exit 1
|
||||
echo "::warning::Skills are out of date — the hourly auto-sync PR will fix this automatically."
|
||||
fi
|
||||
|
||||
coverage:
|
||||
|
||||
@@ -15,12 +15,15 @@
|
||||
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; this bot targets PR branches
|
||||
- main # main is kept up to date by PR merges
|
||||
|
||||
concurrency:
|
||||
group: generate-skills-${{ github.ref }}
|
||||
group: generate-skills-${{ github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
@@ -31,15 +34,14 @@ jobs:
|
||||
name: Generate and commit skills
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # needed to push the auto-commit
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# Check out the PR head branch so we can push back to it.
|
||||
# For push events on a branch this is already the branch SHA.
|
||||
# For cron/dispatch: check out main. For push: check out the branch.
|
||||
ref: ${{ github.head_ref || github.ref_name }}
|
||||
# Use the default GITHUB_TOKEN — it has write access to the same repo.
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install Rust
|
||||
@@ -56,16 +58,59 @@ jobs:
|
||||
- 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@v7
|
||||
with:
|
||||
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'
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
if git diff --quiet; then
|
||||
echo "No skill changes — nothing to commit."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git add skills/ docs/skills.md
|
||||
git commit -m "chore: regenerate skills [skip ci]"
|
||||
git push
|
||||
|
||||
@@ -147,7 +147,7 @@ gws admin <resource> <method> [flags]
|
||||
|
||||
### users
|
||||
|
||||
- `createGuest` — Create a guest user with access to a [subset of Workspace capabilities](https://support.google.com/a/answer/16558545). This feature is currently in Alpha. Please reach out to support if you are intere
|
||||
- `createGuest` — Create a guest user with access to a [subset of Workspace capabilities](https://support.google.com/a/answer/16558545?hl=en). This feature is currently in Alpha. Please reach out to support if you are
|
||||
- `delete` — Deletes a user.
|
||||
- `get` — Retrieves a user.
|
||||
- `insert` — Creates a user. Mutate calls immediately following user creation might sometimes fail as the user isn't fully created due to propagation delay in our backends. Check the error details for the "User cr
|
||||
|
||||
Reference in New Issue
Block a user