Skip to content

Commit f33d356

Browse files
committed
ci: add ban-words lint job
1 parent 0dade44 commit f33d356

File tree

4 files changed

+72
-3
lines changed

4 files changed

+72
-3
lines changed

.github/workflows/ban-words.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Ban Words Lint
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
pull-requests: write
10+
contents: read
11+
12+
env:
13+
BUN_VERSION: "1.2.10"
14+
15+
jobs:
16+
ban-words:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Setup Bun
21+
uses: ./.github/actions/setup-bun
22+
with:
23+
bun-version: ${{ env.BUN_VERSION }}
24+
- name: Run ban words test
25+
id: ban
26+
shell: bash
27+
run: |
28+
set +e
29+
bun test $(realpath test/internal/ban-words.ci-lint.ts) > ban-words.log 2>&1
30+
echo $? > exitcode.txt
31+
cat ban-words.log
32+
echo "exitcode=$(cat exitcode.txt)" >> $GITHUB_OUTPUT
33+
{
34+
echo 'text<<EOF'
35+
cat ban-words.log
36+
echo EOF
37+
} >> "$GITHUB_OUTPUT"
38+
- name: Find Comment
39+
id: comment
40+
uses: peter-evans/find-comment@v3
41+
with:
42+
issue-number: ${{ github.event.pull_request.number }}
43+
comment-author: github-actions[bot]
44+
body-includes: <!-- generated-comment ban-words -->
45+
- name: Write Comment
46+
if: steps.ban.outputs.exitcode != '0'
47+
uses: peter-evans/create-or-update-comment@v4
48+
with:
49+
comment-id: ${{ steps.comment.outputs.comment-id }}
50+
issue-number: ${{ github.event.pull_request.number }}
51+
edit-mode: replace
52+
body: |
53+
@${{ github.actor }}, banned words test failed:
54+
55+
```
56+
${{ steps.ban.outputs.text }}
57+
```
58+
59+
Commit: ${{ github.sha }}
60+
61+
<!-- generated-comment ban-words -->
62+
- name: Delete old comment
63+
if: steps.ban.outputs.exitcode == '0' && steps.comment.outputs.comment-id != ''
64+
uses: actions-cool/issues-helper@v3
65+
with:
66+
actions: delete-comment
67+
token: ${{ secrets.GITHUB_TOKEN }}
68+
issue-number: ${{ github.event.pull_request.number }}
69+
comment-id: ${{ steps.comment.outputs.comment-id }}

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
✅ Good
66

77
```sh
8-
bun agent test internal/ban-words.test.ts
8+
bun agent test internal/ban-words.ci-lint.ts
99
bun agent ./foo.ts
1010
```
1111

@@ -24,7 +24,7 @@ bun agent ./foo.ts
2424
To run a single test, you need to use the `bun agent test <test-name>` command.
2525

2626
```sh
27-
bun agent test internal/ban-words.test.ts
27+
bun agent test internal/ban-words.ci-lint.ts
2828
```
2929

3030
You must ALWAYS make sure to pass a file path to the `bun agent test <file-path>` command. DO NOT try to run ALL the tests at once unless you're in a specific subdirectory.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"lint:fix": "oxlint --config oxlint.json --fix",
5454
"test": "node scripts/runner.node.mjs --exec-path ./build/debug/bun-debug",
5555
"test:release": "node scripts/runner.node.mjs --exec-path ./build/release/bun",
56-
"banned": "bun test test/internal/ban-words.test.ts",
56+
"banned": "bun test test/internal/ban-words.ci-lint.ts",
5757
"glob-sources": "bun scripts/glob-sources.mjs",
5858
"zig": "vendor/zig/zig.exe",
5959
"zig:test": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUN_TEST=ON -B build/debug",
File renamed without changes.

0 commit comments

Comments
 (0)