-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (36 loc) · 1.13 KB
/
diff.yml
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
43
name: Export Changed Files
on:
push:
branches:
- main
jobs:
export-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Find Changed Files
id: find_changed_files
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
if [ -z "$CHANGED_FILES" ]; then
echo "No changes detected."
exit 0
fi
echo "::set-output name=changed_files::$CHANGED_FILES"
- name: Create Directory for Changed Files
run: mkdir changed_files
- name: Copy Changed Files
if: steps.find_changed_files.outputs.changed_files != ''
run: |
while read file; do
cp --parents "$file" changed_files/
done <<< "${{ steps.find_changed_files.outputs.changed_files }}"
- name: Upload Changed Files
if: steps.find_changed_files.outputs.changed_files != ''
uses: actions/upload-artifact@v3
with:
name: changed-files
path: changed_files/