Merge pull request '优化CI流程' (#5) from dev into main
Reviewed-on: jjnwxs/jingji_spbook_vue#5
This commit is contained in:
commit
ba7e31022a
@ -1,13 +1,43 @@
|
|||||||
name: test-doc
|
name: Checking-doc
|
||||||
run-name: Testing doc — ${{ gitea.run_id }}
|
run-name: Checking doc — ${{ gitea.run_id }}
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened]
|
types: [opened,synchronize]
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check-file-changes:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
should_run: ${{ steps.filter.outputs.should_run }}
|
||||||
|
steps:
|
||||||
|
- name: 🚚 Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: 📑 Check changed files
|
||||||
|
id: filter
|
||||||
|
run: |
|
||||||
|
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} || git diff --name-only HEAD~1 HEAD)
|
||||||
|
|
||||||
|
IMPORTANT_FILE_CHANGED=false
|
||||||
|
for file in $CHANGED_FILES; do
|
||||||
|
if [[ $file =~ \.(ts|yaml|json|js)$ ]]; then
|
||||||
|
IMPORTANT_FILE_CHANGED=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$IMPORTANT_FILE_CHANGED" = true ]; then
|
||||||
|
echo "should_run=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "should_run=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
|
needs: check-file-changes
|
||||||
|
if: ${{ needs.check-file-changes.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
Loading…
x
Reference in New Issue
Block a user