chore(deps): update dependency @book000/eslint-config to v1.7.116 #2701
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Node.js でビルド・テストを実行する。バージョンは .node-version に記載されているものを利用する | |
name: Node CI | |
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
branches: | |
- main | |
- master | |
types: | |
- opened | |
- synchronize | |
pull_request_target: | |
branches: | |
- main | |
- master | |
types: | |
- labeled | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
node-ci: | |
runs-on: ubuntu-latest | |
if: ${{ | |
github.event_name == 'push' || | |
github.event_name == 'workflow_dispatch' || | |
github.event_name == 'schedule' || | |
(github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name) || | |
(github.event_name == 'pull_request_target' && github.repository != github.event.pull_request.head.repo.full_name && contains(github.event.label.name, '🚀request-ci')) | |
}} | |
services: | |
mysql: | |
image: mysql:9.1 | |
env: | |
MYSQL_ROOT_PASSWORD: rootPassword | |
MYSQL_USER: pixiv-ts | |
MYSQL_PASSWORD: pixiv-ts-test | |
MYSQL_DATABASE: pixiv-ts | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
steps: | |
- name: 🛎 Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: 🏗 Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
id: pnpm-install | |
with: | |
run_install: false | |
- name: 📃 Check package.json definition | |
id: package-json | |
run: | | |
compile=$(jq '.scripts | has("compile")' package.json) | |
build=$(jq '.scripts | has("build")' package.json) | |
generate=$(jq '.scripts | has("generate")' package.json) | |
package=$(jq '.scripts | has("package")' package.json) | |
lint=$(jq '.scripts | has("lint")' package.json) | |
test=$(jq '.scripts | has("test")' package.json) | |
echo "compile: $compile" | |
echo "build: $build" | |
echo "generate: $generate" | |
echo "package: $package" | |
echo "lint: $lint" | |
echo "test: $test" | |
echo "compile=$compile" >> $GITHUB_OUTPUT | |
echo "build=$build" >> $GITHUB_OUTPUT | |
echo "generate=$generate" >> $GITHUB_OUTPUT | |
echo "package=$package" >> $GITHUB_OUTPUT | |
echo "lint=$lint" >> $GITHUB_OUTPUT | |
echo "test=$test" >> $GITHUB_OUTPUT | |
- name: 📂 Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: 📂 Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: 👨🏻💻 Install dependencies | |
run: | | |
pnpm install --frozen-lockfile --prefer-frozen-lockfile | |
- name: 👀 Run linter | |
if: steps.package-json.outputs.lint == 'true' | |
run: pnpm run lint | |
- name: 🎁 Run package | |
if: steps.package-json.outputs.package == 'true' | |
run: pnpm run package | |
- name: 🏃 Run compile | |
if: steps.package-json.outputs.compile == 'true' | |
run: pnpm run compile | |
- name: 🧪 Run tests | |
if: steps.package-json.outputs.test == 'true' | |
run: pnpm run test | |
env: | |
PIXIV_REFRESH_TOKEN: ${{ secrets.PIXIV_REFRESH_TOKEN }} | |
NODE_ENV: test | |
RESPONSE_DB_HOSTNAME: localhost | |
RESPONSE_DB_USERNAME: pixiv-ts | |
RESPONSE_DB_PASSWORD: pixiv-ts-test | |
RESPONSE_DB_DATABASE: pixiv-ts | |
RESPONSE_DB_PORT: 3306 | |
- name: ☑️ Check Dependencies | |
if: steps.package-json.outputs.disabled-depcheck == 'false' | |
run: npx depcheck | |
- name: Check exists dist directory | |
id: check-dist | |
run: | | |
IS_DIRECTORY=$(test -d dist && echo true || echo false) | |
IS_SYMLINK=$(test -L dist && echo true || echo false) | |
echo "exists=$(test $IS_DIRECTORY = true && $IS_NOT_SYMLINK = false && echo true || echo false)" >> $GITHUB_OUTPUT | |
- name: 📦 Upload dist artifact | |
if: steps.check-dist.outputs.exists == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Check exists output directory | |
id: check-output | |
run: | | |
IS_DIRECTORY=$(test -d output && echo true || echo false) | |
IS_SYMLINK=$(test -L output && echo true || echo false) | |
echo "exists=$(test $IS_DIRECTORY = true && $IS_NOT_SYMLINK = false && echo true || echo false)" >> $GITHUB_OUTPUT | |
- name: 📦 Upload output artifact | |
if: steps.check-output.outputs.exists == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: output | |
path: output | |
- name: 👀 Check git status | |
run: | | |
git status | |
git diff --exit-code || (echo "Git status is not clean." && exit 1) | |
comment: | |
name: Comment | |
runs-on: ubuntu-latest | |
if: ${{ | |
github.event_name == 'pull_request_target' && | |
github.event.action == 'opened' && | |
github.repository != github.event.pull_request.head.repo.full_name | |
}} | |
steps: | |
- name: Create PR comment | |
run: | | |
cat << EOF > comment.md | |
# ⚠️ CIの実行には \`🚀request-ci\` ラベルが必要です | |
このリポジトリはフォークされたリポジトリです。 | |
セキュリティ上の理由から、フォークされたリポジトリからのCI実行は自動的に行われません。 | |
CI実行をリクエストするには、このプルリクエストに \`🚀request-ci\` ラベルを追加してください。 | |
(ラベルを追加できるのは一部のメンバーのみです) | |
EOF | |
gh pr comment ${{ github.event.number }} -R ${{ github.repository }} -F comment.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
finished-node-ci: | |
name: Check finished Node CI | |
runs-on: ubuntu-latest | |
if: always() | |
needs: | |
- node-ci | |
steps: | |
- name: Workflow conclusion | |
uses: technote-space/workflow-conclusion-action@v3 | |
- name: Check finished Node CI | |
run: | | |
if [ "${{ env.WORKFLOW_CONCLUSION }}" != "success" ]; then | |
echo "Build failed" | |
exit 1 | |
fi | |
- name: Remove label | |
if: ${{ github.event_name == 'pull_request_target' && contains(github.event.label.name, '🚀request-ci') }} | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: ['🚀request-ci'] | |
}) |