Skip to content

Commit a58961f

Browse files
authored
Merge pull request #5 from objectstack-ai/copilot/add-necessary-automation-workflows
2 parents e024cd7 + 73248f2 commit a58961f

File tree

9 files changed

+583
-0
lines changed

9 files changed

+583
-0
lines changed

.github/WORKFLOWS.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# Automation Workflows
2+
3+
This document provides an overview of all automation workflows configured in this repository.
4+
5+
## Continuous Integration & Deployment
6+
7+
### CI Workflow (`ci.yml`)
8+
**Trigger:** Push to `main` or `develop`, Pull Requests, Manual dispatch
9+
10+
**What it does:**
11+
- Tests code on Node.js 18.x and 20.x
12+
- Installs dependencies using `npm ci`
13+
- Runs TypeScript type checking
14+
- Builds all workspace packages
15+
- Runs all example scripts to validate functionality:
16+
- Basic example
17+
- E-commerce example
18+
- Blog example
19+
- CRM example
20+
- Comprehensive CRM example
21+
- Archives build artifacts (for Node.js 20.x)
22+
23+
**Matrix Strategy:** Tests on multiple Node.js versions to ensure compatibility
24+
25+
---
26+
27+
### Code Quality Workflow (`code-quality.yml`)
28+
**Trigger:** Pull Requests to `main` or `develop`, Manual dispatch
29+
30+
**What it does:**
31+
- Runs comprehensive TypeScript type checking
32+
- Verifies successful build without TypeScript errors
33+
- Validates package structure (directories and files exist)
34+
- Tests that examples can execute successfully
35+
36+
**Purpose:** Ensures code quality before merging PRs
37+
38+
---
39+
40+
### Release Workflow (`release.yml`)
41+
**Trigger:** Git tags matching `v*.*.*` pattern (e.g., v1.0.0), Manual dispatch
42+
43+
**What it does:**
44+
- Builds all packages
45+
- Creates GitHub releases automatically
46+
- Generates release notes from commits
47+
- Attaches package.json files and documentation to release
48+
49+
**Usage:** Create and push a version tag to trigger a release:
50+
```bash
51+
git tag v1.0.0
52+
git push origin v1.0.0
53+
```
54+
55+
---
56+
57+
## Dependency Management
58+
59+
### Dependabot (`dependabot.yml`)
60+
**Trigger:** Weekly on Mondays
61+
62+
**What it does:**
63+
- Checks for npm dependency updates in:
64+
- Root package
65+
- Core package (`packages/core`)
66+
- Examples package (`packages/examples`)
67+
- Checks for GitHub Actions updates
68+
- Creates PRs with dependency updates
69+
- Auto-assigns PRs to `hotlong`
70+
- Limits to 5 PRs per ecosystem
71+
- Adds appropriate labels (dependencies, core, examples, github-actions)
72+
73+
**Configuration:**
74+
- Conventional commit messages with scope
75+
- Weekly schedule
76+
- Separate configurations for better organization
77+
78+
---
79+
80+
## Repository Automation
81+
82+
### Auto-assign Workflow (`auto-assign.yml`)
83+
**Trigger:** New issues or pull requests
84+
85+
**What it does:**
86+
- Automatically assigns new issues and PRs to `hotlong`
87+
- Assigns 1 person per issue/PR
88+
89+
---
90+
91+
### Auto-label Workflow (`auto-label.yml`)
92+
**Trigger:** PR opened, synchronized, or reopened
93+
94+
**What it does:**
95+
- Automatically labels PRs based on changed files:
96+
- `core` - Changes in packages/core
97+
- `examples` - Changes in packages/examples
98+
- `documentation` - Changes in markdown files
99+
- `dependencies` - Changes in package.json files
100+
- `ci/cd` - Changes in workflow files
101+
- `typescript` - Changes in TypeScript files
102+
- `configuration` - Changes in config files
103+
104+
**Configuration:** Uses `.github/labeler.yml` for label rules
105+
106+
---
107+
108+
### Stale Issues/PRs Workflow (`stale.yml`)
109+
**Trigger:** Daily at 00:00 UTC, Manual dispatch
110+
111+
**What it does:**
112+
- Marks issues as stale after 60 days of inactivity
113+
- Closes stale issues after 7 additional days
114+
- Marks PRs as stale after 30 days of inactivity
115+
- Closes stale PRs after 7 additional days
116+
- Removes stale label when activity resumes
117+
- Exempts pinned, security, and enhancement issues
118+
- Exempts pinned, security, and work-in-progress PRs
119+
120+
**Purpose:** Keeps the issue tracker clean and organized
121+
122+
---
123+
124+
### Proof HTML Workflow (`proof-html.yml`)
125+
**Trigger:** Push to any branch, Manual dispatch
126+
127+
**What it does:**
128+
- Validates HTML content in the repository
129+
- Checks for broken links and HTML issues
130+
131+
---
132+
133+
## Best Practices
134+
135+
### For Contributors
136+
1. **Before creating a PR:**
137+
- Run `npm run type-check` locally
138+
- Run `npm run build` to ensure no build errors
139+
- Test relevant examples
140+
141+
2. **Dependency updates:**
142+
- Review Dependabot PRs regularly
143+
- Test changes before merging
144+
145+
3. **Releases:**
146+
- Use semantic versioning (MAJOR.MINOR.PATCH)
147+
- Tag releases with `v` prefix (e.g., v1.0.0)
148+
149+
### For Maintainers
150+
1. **Weekly tasks:**
151+
- Review Dependabot PRs
152+
- Check stale issues/PRs
153+
- Monitor CI failures
154+
155+
2. **Release process:**
156+
- Update version in package.json files
157+
- Create and push git tag
158+
- Verify release workflow success
159+
160+
3. **Workflow maintenance:**
161+
- Keep GitHub Actions up to date
162+
- Review workflow runs regularly
163+
- Adjust stale timings as needed
164+
165+
## Troubleshooting
166+
167+
### CI Failures
168+
1. Check the workflow run in GitHub Actions tab
169+
2. Review error logs for specific failures
170+
3. Run the same commands locally to reproduce
171+
4. Common issues:
172+
- TypeScript errors: Run `npm run type-check`
173+
- Build errors: Run `npm run build`
174+
- Example failures: Run specific example script
175+
176+
### Dependabot Issues
177+
1. Check for breaking changes in dependency updates
178+
2. Review changelogs of updated packages
179+
3. Test locally before merging
180+
4. Adjust version constraints if needed
181+
182+
### Stale Bot False Positives
183+
1. Add `pinned` label to keep issues open
184+
2. Comment on issues to reset the timer
185+
3. Adjust stale timings in `stale.yml` if needed
186+
187+
## Workflow Files
188+
189+
- `.github/workflows/ci.yml` - Main CI pipeline
190+
- `.github/workflows/code-quality.yml` - Code quality checks
191+
- `.github/workflows/release.yml` - Release automation
192+
- `.github/workflows/auto-assign.yml` - Auto-assignment
193+
- `.github/workflows/auto-label.yml` - Auto-labeling
194+
- `.github/workflows/stale.yml` - Stale issue management
195+
- `.github/workflows/proof-html.yml` - HTML validation
196+
- `.github/dependabot.yml` - Dependency update config
197+
- `.github/labeler.yml` - Auto-labeling rules

.github/dependabot.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for npm dependencies
4+
- package-ecosystem: "npm"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
open-pull-requests-limit: 5
10+
reviewers:
11+
- "hotlong"
12+
assignees:
13+
- "hotlong"
14+
commit-message:
15+
prefix: "chore"
16+
include: "scope"
17+
labels:
18+
- "dependencies"
19+
- "automated"
20+
21+
# Core package dependencies
22+
- package-ecosystem: "npm"
23+
directory: "/packages/core"
24+
schedule:
25+
interval: "weekly"
26+
day: "monday"
27+
open-pull-requests-limit: 5
28+
reviewers:
29+
- "hotlong"
30+
assignees:
31+
- "hotlong"
32+
commit-message:
33+
prefix: "chore"
34+
prefix-development: "chore"
35+
include: "scope"
36+
labels:
37+
- "dependencies"
38+
- "core"
39+
- "automated"
40+
41+
# Examples package dependencies
42+
- package-ecosystem: "npm"
43+
directory: "/packages/examples"
44+
schedule:
45+
interval: "weekly"
46+
day: "monday"
47+
open-pull-requests-limit: 5
48+
reviewers:
49+
- "hotlong"
50+
assignees:
51+
- "hotlong"
52+
commit-message:
53+
prefix: "chore"
54+
prefix-development: "chore"
55+
include: "scope"
56+
labels:
57+
- "dependencies"
58+
- "examples"
59+
- "automated"
60+
61+
# GitHub Actions
62+
- package-ecosystem: "github-actions"
63+
directory: "/"
64+
schedule:
65+
interval: "weekly"
66+
day: "monday"
67+
open-pull-requests-limit: 3
68+
reviewers:
69+
- "hotlong"
70+
assignees:
71+
- "hotlong"
72+
commit-message:
73+
prefix: "ci"
74+
include: "scope"
75+
labels:
76+
- "github-actions"
77+
- "automated"

.github/labeler.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Auto-labeling configuration
2+
# Add labels to pull requests based on the files that are changed
3+
4+
'core':
5+
- changed-files:
6+
- any-glob-to-any-file: 'packages/core/**/*'
7+
8+
'examples':
9+
- changed-files:
10+
- any-glob-to-any-file: 'packages/examples/**/*'
11+
12+
'documentation':
13+
- changed-files:
14+
- any-glob-to-any-file:
15+
- '*.md'
16+
- 'packages/**/README.md'
17+
18+
'dependencies':
19+
- changed-files:
20+
- any-glob-to-any-file:
21+
- 'package.json'
22+
- 'package-lock.json'
23+
- 'packages/*/package.json'
24+
- 'packages/*/package-lock.json'
25+
26+
'ci/cd':
27+
- changed-files:
28+
- any-glob-to-any-file:
29+
- '.github/workflows/**/*'
30+
- '.github/dependabot.yml'
31+
32+
'typescript':
33+
- changed-files:
34+
- any-glob-to-any-file:
35+
- '**/*.ts'
36+
- '**/tsconfig.json'
37+
38+
'configuration':
39+
- changed-files:
40+
- any-glob-to-any-file:
41+
- '**/*.config.ts'
42+
- '**/*.config.js'
43+
- '**/*.config.json'
44+
- '.gitignore'

.github/workflows/auto-label.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Auto Label
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
label:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Label based on changed files
19+
uses: actions/labeler@v5
20+
with:
21+
repo-token: ${{ secrets.GITHUB_TOKEN }}
22+
configuration-path: .github/labeler.yml

0 commit comments

Comments
 (0)