Compare commits

...

1 Commits

Author SHA1 Message Date
Jarred Sumner
f33d356887 ci: add ban-words lint job 2025-05-19 09:21:22 -07:00
4 changed files with 72 additions and 3 deletions

69
.github/workflows/ban-words.yml vendored Normal file
View File

@@ -0,0 +1,69 @@
name: Ban Words Lint
on:
pull_request:
branches:
- main
permissions:
pull-requests: write
contents: read
env:
BUN_VERSION: "1.2.10"
jobs:
ban-words:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Run ban words test
id: ban
shell: bash
run: |
set +e
bun test $(realpath test/internal/ban-words.ci-lint.ts) > ban-words.log 2>&1
echo $? > exitcode.txt
cat ban-words.log
echo "exitcode=$(cat exitcode.txt)" >> $GITHUB_OUTPUT
{
echo 'text<<EOF'
cat ban-words.log
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Find Comment
id: comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: github-actions[bot]
body-includes: <!-- generated-comment ban-words -->
- name: Write Comment
if: steps.ban.outputs.exitcode != '0'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
@${{ github.actor }}, banned words test failed:
```
${{ steps.ban.outputs.text }}
```
Commit: ${{ github.sha }}
<!-- generated-comment ban-words -->
- name: Delete old comment
if: steps.ban.outputs.exitcode == '0' && steps.comment.outputs.comment-id != ''
uses: actions-cool/issues-helper@v3
with:
actions: delete-comment
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.comment.outputs.comment-id }}

View File

@@ -5,7 +5,7 @@
✅ Good
```sh
bun agent test internal/ban-words.test.ts
bun agent test internal/ban-words.ci-lint.ts
bun agent ./foo.ts
```
@@ -24,7 +24,7 @@ bun agent ./foo.ts
To run a single test, you need to use the `bun agent test <test-name>` command.
```sh
bun agent test internal/ban-words.test.ts
bun agent test internal/ban-words.ci-lint.ts
```
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.

View File

@@ -53,7 +53,7 @@
"lint:fix": "oxlint --config oxlint.json --fix",
"test": "node scripts/runner.node.mjs --exec-path ./build/debug/bun-debug",
"test:release": "node scripts/runner.node.mjs --exec-path ./build/release/bun",
"banned": "bun test test/internal/ban-words.test.ts",
"banned": "bun test test/internal/ban-words.ci-lint.ts",
"glob-sources": "bun scripts/glob-sources.mjs",
"zig": "vendor/zig/zig.exe",
"zig:test": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUN_TEST=ON -B build/debug",