-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (45 loc) · 1.3 KB
/
main.yml
File metadata and controls
55 lines (45 loc) · 1.3 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
43
44
45
46
47
48
49
50
51
52
53
54
name: dba_artifact
on:
push:
branches: [ main ]
paths:
- 'scripts/**'
pull_request:
branches: [ main ]
paths:
- 'scripts/**'
jobs:
# Identify the folder that needs to be packaged into an artifact
setup:
runs-on: ubuntu-latest
outputs:
create_artifact: ${{ steps.set-dir.outputs.create_artifact }}
path: ${{ steps.set-dir.outputs.path }}
steps:
- uses: actions/checkout@v2
- id: files
name: Get change set
uses: jitterbit/get-changed-files@v1
with:
format: 'csv'
- id: set-dir
name: Calculate directories to turn into artifacts
run: |
declare -a dirs=()
for d in scripts/*/ ; do
if [[ ${{ steps.files.outputs.all }} =~ $d ]];
then
dirs+=("${d}")
fi
done
if [ ${#dirs[@]} -gt 1 ];
then
echo "You may not change more than 1 directory in a single PR. This one has ${#dirs[@]} directories with changes."
exit 1
fi
echo "::set-output name=path::${dirs[0]}"
- uses: actions/upload-artifact@v3
if: ${{ success() }}
with:
name: "changescripts"
path: ${{ steps.set-dir.outputs.path }}