-
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (82 loc) · 2.49 KB
/
ci.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Changes detected!
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'refre.sh'
- 'renovate.json'
pull_request:
types:
- opened
- reopened
- synchronized
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'refre.sh'
- 'renovate.json'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
find_changes:
name: Find Changes
runs-on: ubuntu-latest
container: archlinux:base-devel
timeout-minutes: 5
outputs:
list: ${{ steps.changes.outputs.changed_pkgs }}
steps:
- name: Update system and install dependencies
run: |
pacman-key --init
pacman -Syu --noconfirm git jq
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Find Changes
id: changes
run: |
if [ ${{ github.event_name }} == 'push' ]
then
if [ ${{ github.event.forced }} ]
then
# current=${{ github.event.before }}
# while git rev-list ${{ github.event.ref }}..${{ github.event.before }} -n1; [ -ne 0 ]
# do
# done
echo ${{ github.event.commits }}
echo ${{ fromJson(github.event.commits) }}
echo ${{ fromJson(github.event.commits[@]) }}
for commit in ${{ github.event.commits[@] }}
do
echo $commit
done
else
CHANGED_DIRS=$(git diff --name-only ${{ github.event.before }}..${{ github.event.after }} | cut -d / -f 1)
fi
elif [ ${{ github.event_name }} == 'pull_request' ]
then
CHANGED_DIRS=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | cut -d / -f 1)
elif [ ${{ github.event_name }} == 'workflow_dispatch' ]
then
CHANGED_DIRS=$(git diff --name-only HEAD..HEAD~1 | cut -d / -f 1)
fi
# Remove .github from CHANGED_DIRS
FINAL_CHANGED_DIRS=()
for dir in $(echo $CHANGED_DIRS | sed "s|.github||")
do
FINAL_CHANGED_DIRS+=("${dir}")
done
# Set output
echo "changed_pkgs=$(jq -cn '$ARGS.positional' --args "${FINAL_CHANGED_DIRS[@]}")" >> $GITHUB_OUTPUT
build:
name: Build
needs: find_changes
uses: ./.github/workflows/build.yml
with:
packages: ${{ needs.find_changes.outputs.list }}