Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://docs.renovatebot.com/configuration-options/
{
extends: ["github>SigureMo/renovate-config"],
extends: ['github>SigureMo/renovate-config'],
}
23 changes: 10 additions & 13 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# In TypeScript actions, `dist/` is a special directory. When you reference
# an action with the `uses:` property, `dist/index.js` is the code that will be
# run. For this project, the `dist/index.js` file is transpiled from other
# source files. This workflow ensures the `dist/` directory contains the
# expected transpiled code.
# run. For this project, the `dist/index.js` file is bundled from the source
# files with Vite+. This workflow ensures the `dist/` directory contains the
# expected bundled code.
#
# If this workflow is run from a feature branch, it will act as an additional CI
# check and fail if the checked-in `dist/` directory does not match what is
# expected from the build.
name: Check Transpiled JavaScript
name: Check Bundled JavaScript

on:
pull_request:
Expand All @@ -31,22 +31,19 @@ jobs:
id: checkout
uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v6

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v6
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: .node-version
cache: pnpm
run-install: false
cache: true

- name: Install dependencies
run: pnpm i --frozen-lockfile
run: vp install --frozen-lockfile

- name: Build dist/ Directory
id: build
run: pnpm run bundle
run: vp pack

# This will fail the workflow if the `dist/` directory is different than
# expected.
Expand Down
27 changes: 12 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,28 @@ permissions:

jobs:
test-typescript:
name: TypeScript Tests
name: TypeScript Checks
runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v6

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v6
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: .node-version
cache: pnpm
run-install: false
cache: true

- name: Install dependencies
run: pnpm i --frozen-lockfile
run: vp install --frozen-lockfile

- name: Check Format
id: pnpm-format-check
run: pnpm run format:check
- name: Run checks
id: vp-check
run: vp check

- name: Run Tests
id: pnpm-test
run: pnpm test
- name: Run tests
id: vp-test
run: vp test
19 changes: 8 additions & 11 deletions .github/workflows/update-dist.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update Transpiled JavaScript
name: Update Bundled JavaScript

on:
pull_request:
Expand All @@ -25,22 +25,19 @@ jobs:
ref: ${{ github.head_ref }}
token: ${{ secrets.UPDATE_DIST_TOKEN }}

- name: Install pnpm
uses: pnpm/action-setup@v6

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v6
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: .node-version
cache: pnpm
run-install: false
cache: true

- name: Install dependencies
run: pnpm i --frozen-lockfile
run: vp install --frozen-lockfile

- name: Build dist/ Directory
id: build
run: pnpm run bundle
run: vp pack

# This will commit the updated `dist/` directory if it is different than
# expected.
Expand All @@ -58,7 +55,7 @@ jobs:
git config user.name "ShigureNyako"
git config user.email "shigure_nyako@outlook.com"
git add dist/
git commit -m "🍱 chore: update transpiled JavaScript in dist/"
git commit -m "🍱 chore: update bundled JavaScript in dist/"
git push
else
echo "No changes detected in dist/. No commit necessary."
Expand Down
4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

22 changes: 0 additions & 22 deletions .prettierrc.json

This file was deleted.

171 changes: 86 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,100 +10,100 @@ This action allows some users have no maintainers permissions to bypass CI check

```yaml
jobs:
check-bypass:
name: Check Bypass
runs-on: ubuntu-slim
permissions:
contents: read
outputs:
can-skip: ${{ steps.check-bypass.outputs.can-skip }}
steps:
- id: check-bypass
name: Check Bypass
uses: PFCCLab/ci-bypass@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
non-pull-request-event-strategy: 'always-skipped'
type: 'labeled'
label: 'ci-bypass: example | ci-bypass: all'
username: 'SigureMo'

build:
needs: check-bypass
if: ${{ needs.check-bypass.outputs.can-skip != 'true' }}
name: Build
runs-on: ubuntu-latest

steps:
- name: Run build
run: echo "Run build"
check-bypass:
name: Check Bypass
runs-on: ubuntu-slim
permissions:
contents: read
outputs:
can-skip: ${{ steps.check-bypass.outputs.can-skip }}
steps:
- id: check-bypass
name: Check Bypass
uses: PFCCLab/ci-bypass@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
non-pull-request-event-strategy: 'always-skipped'
type: 'labeled'
label: 'ci-bypass: example | ci-bypass: all'
username: 'SigureMo'

build:
needs: check-bypass
if: ${{ needs.check-bypass.outputs.can-skip != 'true' }}
name: Build
runs-on: ubuntu-latest

steps:
- name: Run build
run: echo "Run build"
```

### Skip steps

```yaml
permissions:
contents: read
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- id: check-bypass
name: Check Bypass
uses: PFCCLab/ci-bypass@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
non-pull-request-event-strategy: 'always-skipped'
type: 'labeled'
label: 'ci-bypass: example | ci-bypass: all'
username: 'SigureMo'
- name: Run build
if: ${{ steps.check-bypass.outputs.can-skip != 'true' }}
run: echo "Run build"
build:
name: Build
runs-on: ubuntu-latest

steps:
- id: check-bypass
name: Check Bypass
uses: PFCCLab/ci-bypass@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
non-pull-request-event-strategy: 'always-skipped'
type: 'labeled'
label: 'ci-bypass: example | ci-bypass: all'
username: 'SigureMo'
- name: Run build
if: ${{ steps.check-bypass.outputs.can-skip != 'true' }}
run: echo "Run build"
```

### Skip with composite rule

```yaml
permissions:
contents: read
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- id: check-bypass
name: Check Bypass
uses: PFCCLab/ci-bypass@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
non-pull-request-event-strategy: 'always-skipped'
type: 'composite'
composite-rule: |
{
"any": [
{
"type": "labeled",
"label": ["ci-bypass: example", "ci-bypass: all"],
"username": ["SigureMo"]
},
{
"type": "commented",
"comment-pattern": [".*/bypass example.*", ".*/bypass all.*"],
"username": ["SigureMo"]
},
{
"type": "approved",
"username": ["SigureMo", "gouzil"]
}
]
}
- name: Run build
if: ${{ steps.check-bypass.outputs.can-skip != 'true' }}
run: echo "Run build"
build:
name: Build
runs-on: ubuntu-latest

steps:
- id: check-bypass
name: Check Bypass
uses: PFCCLab/ci-bypass@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
non-pull-request-event-strategy: 'always-skipped'
type: 'composite'
composite-rule: |
{
"any": [
{
"type": "labeled",
"label": ["ci-bypass: example", "ci-bypass: all"],
"username": ["SigureMo"]
},
{
"type": "commented",
"comment-pattern": [".*/bypass example.*", ".*/bypass all.*"],
"username": ["SigureMo"]
},
{
"type": "approved",
"username": ["SigureMo", "gouzil"]
}
]
}
- name: Run build
if: ${{ steps.check-bypass.outputs.can-skip != 'true' }}
run: echo "Run build"
```

### All options
Expand Down Expand Up @@ -131,19 +131,20 @@ jobs:
1. Install the dependencies:

```bash
pnpm install
vp install
```

2. Test the basic functionality:
2. Run checks and tests:

```bash
pnpm test
vp check
vp test
```

3. Run bundle:
3. Build the bundled action output:

```bash
pnpm bundle
vp pack
```

## Acknowledgement
Expand Down
2 changes: 1 addition & 1 deletion __tests__/composite.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, assert } from 'vitest'
import { describe, it, assert } from 'vite-plus/test'
import { type Composite, resolveComposite, resolveCompositeAsync } from '../src/composite.js'

describe.concurrent('Test Composite', () => {
Expand Down
Loading
Loading