File tree 2 files changed +35
-12
lines changed
2 files changed +35
-12
lines changed Original file line number Diff line number Diff line change 4
4
5
5
go.sum linguist-generated =true
6
6
7
+ # To avoid git status and other tools reporting files due to different line endings
8
+ # normalize the line endings to LF
9
+ * text =auto eol =lf
Original file line number Diff line number Diff line change @@ -12,25 +12,45 @@ jobs:
12
12
changedfiles :
13
13
runs-on : ubuntu-latest
14
14
if : ${{ github.actor != 'dependabot[bot]' }}
15
+ env :
16
+ PR_HEAD : ${{ github.event.pull_request.head.sha }}
15
17
outputs :
16
- go_sources : ${{ steps.changed-source .outputs.go_sources }}
17
- go_tests : ${{ steps.changed-test .outputs.go_tests }}
18
+ go_sources : ${{ steps.changes .outputs.go_sources }}
19
+ go_tests : ${{ steps.changes .outputs.go_tests }}
18
20
steps :
19
21
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
20
22
with :
21
23
fetch-depth : 0
22
- - name : Get changed files
23
- id : changed-source
24
- run : |
25
- files=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main $PR_HEAD) $PR_HEAD | grep .go$ | xargs)
26
24
27
- echo "go_sources=$files" >> $GITHUB_OUTPUT
28
- - name : Get changed files
29
- id : changed-test
25
+ - name : Get changes
26
+ shell : bash
27
+ id : changes
30
28
run : |
31
- files=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main $PR_HEAD) $PR_HEAD | grep _test.go$ | xargs)
29
+ changed_files=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main $PR_HEAD) $PR_HEAD)
30
+ echo changed_files
31
+ echo $changed_files
32
+
33
+ go_sources=$(echo "$changed_files" | tr ' ' '\n' | grep -E '\.go$' | grep -v -E '.*_test\.go$' || true)
34
+ echo go_sources
35
+ echo $go_sources
36
+ if [[ -n "$go_sources" ]]; then
37
+ {
38
+ echo 'go_sources<<EOF'
39
+ echo $go_sources
40
+ echo EOF
41
+ } >> $GITHUB_OUTPUT
42
+ fi
32
43
33
- echo "go_tests=$files" >> $GITHUB_OUTPUT
44
+ go_tests=$(echo "$changed_files" | tr ' ' '\n' | grep -E '.*_test\.go$' || true)
45
+ echo go_tests
46
+ echo $go_tests
47
+ if [[ -n "$go_tests" ]]; then
48
+ {
49
+ echo 'go_tests<<EOF'
50
+ echo $go_tests
51
+ echo EOF
52
+ } >> $GITHUB_OUTPUT
53
+ fi
34
54
35
55
scoped-tests :
36
56
needs : changedfiles
83
103
env :
84
104
CHANGED_GOLANG_SOURCES : ${{ needs.changedfiles.outputs.go_sources }}
85
105
run : |
86
- make for-affected-components CMD="make test "
106
+ make for-affected-components CMD="make"
You can’t perform that action at this time.
0 commit comments