chore: auto triage and fmt (#204)
* chore: auto triage and fmt * chore: address PR review — add area:core, setup.rs to auth, move formatter --------- Co-authored-by: jpoehnelt-bot <jpoehnelt-bot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@googleworkspace/cli": patch
|
||||
---
|
||||
|
||||
chore: add automation workflow for auto-fmt, CLA labeling, and file-based PR triage
|
||||
@@ -0,0 +1,68 @@
|
||||
# Labels applied to PRs based on changed files.
|
||||
# Used by the actions/labeler action in .github/workflows/automation.yml
|
||||
|
||||
"area: auth":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/auth.rs
|
||||
- src/auth_commands.rs
|
||||
- src/setup.rs
|
||||
- src/accounts.rs
|
||||
- src/credential_store.rs
|
||||
- src/token_storage.rs
|
||||
- src/oauth_config.rs
|
||||
|
||||
"area: discovery":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/discovery.rs
|
||||
- src/services.rs
|
||||
|
||||
"area: http":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/executor.rs
|
||||
- src/client.rs
|
||||
|
||||
"area: tui":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/setup_tui.rs
|
||||
|
||||
"area: mcp":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/mcp_server.rs
|
||||
|
||||
"area: skills":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/generate_skills.rs
|
||||
- skills/**
|
||||
|
||||
"area: docs":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "*.md"
|
||||
- docs/**
|
||||
|
||||
"area: distribution":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- .github/workflows/release.yml
|
||||
- .github/workflows/release-changesets.yml
|
||||
- dist-workspace.toml
|
||||
- Cargo.toml
|
||||
|
||||
"area: core":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/main.rs
|
||||
- src/commands.rs
|
||||
- src/error.rs
|
||||
- src/formatter.rs
|
||||
- src/fs_util.rs
|
||||
- src/helpers/**
|
||||
- src/text.rs
|
||||
- src/validate.rs
|
||||
- src/schema.rs
|
||||
@@ -0,0 +1,101 @@
|
||||
# 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: Automation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
check_run:
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: Format
|
||||
if: github.event_name == 'push'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt
|
||||
|
||||
- name: Run cargo fmt
|
||||
run: cargo fmt --all
|
||||
|
||||
- name: Commit and push
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add -A
|
||||
git diff --cached --quiet || git commit -m "style: cargo fmt" && git push
|
||||
|
||||
cla-label:
|
||||
name: CLA Label
|
||||
if: >-
|
||||
github.event_name == 'check_run' &&
|
||||
github.event.check_run.name == 'cla/google'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Update CLA label
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
|
||||
script: |
|
||||
const cr = context.payload.check_run;
|
||||
const passed = cr.conclusion === 'success';
|
||||
|
||||
for (const pr of cr.pull_requests) {
|
||||
const labels = passed
|
||||
? { add: 'cla: yes', remove: 'cla: no' }
|
||||
: { add: 'cla: no', remove: 'cla: yes' };
|
||||
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: pr.number,
|
||||
labels: [labels.add],
|
||||
});
|
||||
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: pr.number,
|
||||
name: labels.remove,
|
||||
});
|
||||
} catch (e) {
|
||||
// Label not present — ignore
|
||||
}
|
||||
}
|
||||
|
||||
file-labeler:
|
||||
name: File Labeler
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
|
||||
sync-labels: true
|
||||
Reference in New Issue
Block a user