Skip to content

Commit 88cb65c

Browse files
Justin Poehneltjpoehnelt-bot
andauthored
chore: auto triage and fmt (npm#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>
1 parent 0ba49d1 commit 88cb65c

3 files changed

Lines changed: 174 additions & 0 deletions

File tree

.changeset/automation-workflow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@googleworkspace/cli": patch
3+
---
4+
5+
chore: add automation workflow for auto-fmt, CLA labeling, and file-based PR triage

.github/labeler.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Labels applied to PRs based on changed files.
2+
# Used by the actions/labeler action in .github/workflows/automation.yml
3+
4+
"area: auth":
5+
- changed-files:
6+
- any-glob-to-any-file:
7+
- src/auth.rs
8+
- src/auth_commands.rs
9+
- src/setup.rs
10+
- src/accounts.rs
11+
- src/credential_store.rs
12+
- src/token_storage.rs
13+
- src/oauth_config.rs
14+
15+
"area: discovery":
16+
- changed-files:
17+
- any-glob-to-any-file:
18+
- src/discovery.rs
19+
- src/services.rs
20+
21+
"area: http":
22+
- changed-files:
23+
- any-glob-to-any-file:
24+
- src/executor.rs
25+
- src/client.rs
26+
27+
"area: tui":
28+
- changed-files:
29+
- any-glob-to-any-file:
30+
- src/setup_tui.rs
31+
32+
"area: mcp":
33+
- changed-files:
34+
- any-glob-to-any-file:
35+
- src/mcp_server.rs
36+
37+
"area: skills":
38+
- changed-files:
39+
- any-glob-to-any-file:
40+
- src/generate_skills.rs
41+
- skills/**
42+
43+
"area: docs":
44+
- changed-files:
45+
- any-glob-to-any-file:
46+
- "*.md"
47+
- docs/**
48+
49+
"area: distribution":
50+
- changed-files:
51+
- any-glob-to-any-file:
52+
- .github/workflows/release.yml
53+
- .github/workflows/release-changesets.yml
54+
- dist-workspace.toml
55+
- Cargo.toml
56+
57+
"area: core":
58+
- changed-files:
59+
- any-glob-to-any-file:
60+
- src/main.rs
61+
- src/commands.rs
62+
- src/error.rs
63+
- src/formatter.rs
64+
- src/fs_util.rs
65+
- src/helpers/**
66+
- src/text.rs
67+
- src/validate.rs
68+
- src/schema.rs

.github/workflows/automation.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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: Automation
16+
17+
on:
18+
push:
19+
branches: [main]
20+
pull_request:
21+
types: [opened, synchronize, reopened]
22+
check_run:
23+
types: [completed]
24+
25+
permissions:
26+
contents: write
27+
pull-requests: write
28+
29+
jobs:
30+
format:
31+
name: Format
32+
if: github.event_name == 'push'
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
with:
37+
token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
38+
39+
- name: Install Rust
40+
uses: dtolnay/rust-toolchain@stable
41+
with:
42+
components: rustfmt
43+
44+
- name: Run cargo fmt
45+
run: cargo fmt --all
46+
47+
- name: Commit and push
48+
run: |
49+
git config user.name "github-actions[bot]"
50+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
51+
git add -A
52+
git diff --cached --quiet || git commit -m "style: cargo fmt" && git push
53+
54+
cla-label:
55+
name: CLA Label
56+
if: >-
57+
github.event_name == 'check_run' &&
58+
github.event.check_run.name == 'cla/google'
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Update CLA label
62+
uses: actions/github-script@v7
63+
with:
64+
github-token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
65+
script: |
66+
const cr = context.payload.check_run;
67+
const passed = cr.conclusion === 'success';
68+
69+
for (const pr of cr.pull_requests) {
70+
const labels = passed
71+
? { add: 'cla: yes', remove: 'cla: no' }
72+
: { add: 'cla: no', remove: 'cla: yes' };
73+
74+
await github.rest.issues.addLabels({
75+
owner: context.repo.owner,
76+
repo: context.repo.repo,
77+
issue_number: pr.number,
78+
labels: [labels.add],
79+
});
80+
81+
try {
82+
await github.rest.issues.removeLabel({
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
issue_number: pr.number,
86+
name: labels.remove,
87+
});
88+
} catch (e) {
89+
// Label not present — ignore
90+
}
91+
}
92+
93+
file-labeler:
94+
name: File Labeler
95+
if: github.event_name == 'pull_request'
96+
runs-on: ubuntu-latest
97+
steps:
98+
- uses: actions/labeler@v5
99+
with:
100+
repo-token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
101+
sync-labels: true

0 commit comments

Comments
 (0)