2023-10-04 02:08:06 +08:00
|
|
|
|
name: pull_request_check
|
2023-09-04 18:11:22 +08:00
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
pull_request:
|
|
|
|
|
branches:
|
|
|
|
|
- main
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
check:
|
2023-10-04 02:08:06 +08:00
|
|
|
|
if: github.repository == 'gkd-kit/subscription'
|
2023-09-04 18:11:22 +08:00
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
2023-10-07 10:25:26 +08:00
|
|
|
|
- name: Get changed files
|
|
|
|
|
id: changed_files
|
|
|
|
|
uses: tj-actions/changed-files@v39
|
|
|
|
|
|
|
|
|
|
- name: Check changed files
|
|
|
|
|
run: |
|
|
|
|
|
if [ ${{ steps.changed_files.outputs.all_changed_files_count }} -ne 1 ]; then
|
|
|
|
|
echo "your changed files count must be 1"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
for file in ${{ steps.changed_files.outputs.all_changed_files }}; do
|
|
|
|
|
echo "$file was changed"
|
|
|
|
|
done
|
|
|
|
|
|
2023-09-22 20:51:33 +08:00
|
|
|
|
- uses: actions/setup-node@v3
|
2023-09-20 23:21:36 +08:00
|
|
|
|
with:
|
2023-09-22 20:51:33 +08:00
|
|
|
|
node-version: 20
|
2023-09-20 00:12:17 +08:00
|
|
|
|
|
2023-09-04 18:11:22 +08:00
|
|
|
|
- uses: pnpm/action-setup@v2
|
|
|
|
|
|
|
|
|
|
- run: pnpm install
|
|
|
|
|
|
|
|
|
|
- run: pnpm run check
|
2023-09-14 14:40:30 +08:00
|
|
|
|
|
2023-09-18 20:29:32 +08:00
|
|
|
|
- run: pnpm run format
|
|
|
|
|
|
|
|
|
|
- run: pnpm run lint
|
|
|
|
|
|
2023-10-04 02:08:06 +08:00
|
|
|
|
- name: check format status
|
2023-09-18 20:29:32 +08:00
|
|
|
|
run: |
|
2023-10-04 02:08:06 +08:00
|
|
|
|
status=$(git status --porcelain)
|
|
|
|
|
if [ -n "$status" ]; then
|
|
|
|
|
echo "Something wasn’t formatted properly"
|
|
|
|
|
git --no-pager diff
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|