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
58 changes: 58 additions & 0 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Check dist/

on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:

jobs:
check-dist:
name: Check dist/
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm

- name: Install dependencies
run: npm ci

- name: Build dist/
run: npm run build

- name: Compare expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/
exit 1
fi
id: diff

- name: Upload artifact
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

- name: Fail if dist/ is out of sync
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
run: |
echo "::error::The dist/ directory is out of sync with the source code. Run 'npm run build' and commit the changes."
exit 1
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Continuous Integration

on:
pull_request:
branches:
- main
push:
branches:
- main

permissions:
contents: write
issues: write
pull-requests: write

jobs:
test-action:
name: GitHub Actions Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Test Local Action
uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
small-threshold: 100
medium-threshold: 300
large-threshold: 600
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version-file: .node-version
cache: npm

- name: Install dependencies
run: npm ci

- name: Build dist/
run: npm run build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"description": "GitHub Action to automatically label PRs based on size",
"main": "index.js",
"scripts": {
"build": "ncc build index.js -o dist",
"test": "echo \"Error: no test specified\" && exit 1",
"bundle": "npm run build",
"build": "ncc build index.js -o dist --license licenses.txt",
"package": "ncc build index.js -o dist --license licenses.txt",
"all": "npm run build",
"test": "echo \"No tests yet\"",
"semantic-release": "semantic-release"
},
"repository": {
Expand Down