blob: f694b90b45a8025486d47964a4a5e7a637baab22 (
plain)
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
|
# GitHub CI Scripts `ci/github-script/`
> **Location**: `ci/github-script/`
> **Platform**: GitHub Actions (`actions/github-script`)
> **Purpose**: PR automation and validation
> **Latest Version**: 0.0.5-1
---
## Overview
This directory contains JavaScript code for GitHub Actions automation using [`actions/github-script`](https://github.com/actions/github-script). These scripts automate various workflow tasks.
---
## Features
| Feature | Description |
|---------|-------------|
| PR validation | Check PR requirements |
| Auto-labeling | Apply labels based on changes |
| Commit checking | Validate commit messages |
| Reviewer assignment | Auto-assign reviewers |
| Branch management | Merge queue handling |
---
## Scripts
| Script | Purpose |
|--------|---------|
| `bot.js` | Main bot logic for PR automation |
| `commits.js` | Commit message validation |
| `merge.js` | Merge queue handling |
| `prepare.js` | PR preparation checks |
| `reviewers.js` | Automatic reviewer assignment |
| `reviews.js` | Review status checking |
| `withRateLimit.js` | GitHub API rate limiting |
---
## Local Development
### Prerequisites
- Node.js 18+
- `gh` CLI (authenticated)
### Setup
```bash
cd ci/github-script
npm install
```
### Running Scripts
```bash
# Check commits in a PR
./run commits Project-Tick ProjT-Launcher 123
# Check labels
./run labels Project-Tick ProjT-Launcher
```
---
## Environment Variables
| Variable | Description |
|----------|-------------|
| `GITHUB_TOKEN` | GitHub API token |
| `GITHUB_REPOSITORY` | Repository (`owner/repo`) |
---
## Integration
These scripts are called from workflows in `.github/workflows/`:
```yaml
- uses: actions/github-script@v7
with:
script: |
const script = require('./ci/github-script/commits.js');
await script({ github, context, core });
```
---
## Related Documentation
- [Workflows](./workflows.md) — CI overview
- [Bot](./bot.md) — Cloudflare Worker bot
- [CI Support](./ci_support.md) — Support files
|