-
Notifications
You must be signed in to change notification settings - Fork 121
42 lines (35 loc) · 1.19 KB
/
alioss-check.yml
File metadata and controls
42 lines (35 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Check alioss in Changed Files
on:
pull_request:
branches:
- main
# allow manually run the action:
workflow_dispatch:
jobs:
img-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for alioss in changed files
run: |
# Fetch the target branch
git fetch origin $GITHUB_BASE_REF
git switch -c check_branch
# Get the diff of the changes
echo Get the diff of the changes
DIFF=$(git diff origin/$GITHUB_BASE_REF check_branch -- . ':(exclude).github/workflows/alioss-check.yml')
if [ -z "$DIFF" ]; then
echo "No changes detected."
exit 0
fi
# Check the diff for alioss
echo Check the diff for alioss
ALIOSS=$(echo "$DIFF" | grep -E '^\+.*(alioss)' | wc -l)
if [ "$ALIOSS" -eq 0 ]; then
echo "No alioss found in changed content.";
exit 0
fi
echo "alioss found in the changes. Please use upload to src/.vuepress/public/img."
echo "$DIFF" | grep -E '^\+.*(alioss)' | tee -a output.log
exit 1