Skip to content

ロールタイムラインを削除 #216

ロールタイムラインを削除

ロールタイムラインを削除 #216

name: Check misskey-js autogen
on:
pull_request:
paths:
- packages/backend/**
- packages/misskey-js/**
- .github/workflows/check-misskey-js-autogen.yml
- .node-version
permissions: {}
jobs:
generate-misskey-js:
runs-on: ubuntu-latest
permissions:
contents: read
if: ${{ github.event.pull_request.mergeable == null || github.event.pull_request.mergeable == true }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: refs/pull/${{ github.event.number }}/merge
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version-file: '.node-version'
cache: pnpm
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Check if lock file is not modified
run: git diff --exit-code pnpm-lock.yaml
- name: Copy config file
run: cp .config/example.yml .config/default.yml
- name: Pre-build
run: pnpm run build-pre
- name: Generate API JSON
run: pnpm --filter backend run generate-api-json
- name: Build misskey-js
run: |
cp packages/backend/built/api.json packages/misskey-js/generator/api.json
pnpm --filter misskey-js-type-generator run generate
- name: Upload Generated
uses: actions/upload-artifact@v4
with:
name: misskey-js-generated
path: packages/misskey-js/generator/built/autogen
get-actual-misskey-js:
runs-on: ubuntu-latest
permissions:
contents: read
if: ${{ github.event.pull_request.mergeable == null || github.event.pull_request.mergeable == true }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: refs/pull/${{ github.event.number }}/merge
sparse-checkout: |
packages/misskey-js/src/autogen
- name: Upload Actual
uses: actions/upload-artifact@v4
with:
name: misskey-js-actual
path: packages/misskey-js/src/autogen
comment-misskey-js-autogen:
runs-on: ubuntu-latest
needs: [generate-misskey-js, get-actual-misskey-js]
permissions:
pull-requests: write
steps:
- name: Download generated misskey-js
uses: actions/download-artifact@v4
with:
name: misskey-js-generated
path: misskey-js-generated
- name: Download actual misskey-js
uses: actions/download-artifact@v4
with:
name: misskey-js-actual
path: misskey-js-actual
- name: check misskey-js changes
id: check-changes
run: |
diff -r -u --label=generated --label=on-tree ./misskey-js-generated ./misskey-js-actual > misskey-js.diff || true
if [ -s misskey-js.diff ]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Send message
if: steps.check-changes.outputs.changes == 'true'
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6
with:
comment_tag: check-misskey-js-autogen
message: |
misskey-jsの型定義の変更を検知しました。
misskey-jsの型定義を再生成してください。
例:
```sh
pnpm run build-misskey-js-with-types
```
- name: Send message
if: steps.check-changes.outputs.changes == 'false'
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6
with:
comment_tag: check-misskey-js-autogen
mode: delete
message: "misskey-jsの型定義に問題はありません。"
- name: Fail if changes are detected
if: steps.check-changes.outputs.changes == 'true'
run: exit 1