-
Notifications
You must be signed in to change notification settings - Fork 10
86 lines (73 loc) · 3.76 KB
/
Copy pathcall_get_changed_files.yml
File metadata and controls
86 lines (73 loc) · 3.76 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
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
name: Get changed files
on:
workflow_call:
outputs:
java_changed:
description: "Whether any Java files have changed"
value: ${{ jobs.check-changed-files.outputs.java_changed}}
orch_alerting_files_changed:
description: "Whether any files have changed in the orchestration-alerting folder"
value: ${{ jobs.check-changed-files.outputs.orch_alerting_files_changed}}
jobs:
check-changed-files:
runs-on: ubuntu-latest
outputs:
java_changed: ${{ steps.changed-java-files.outputs.any_changed }}
orch_alerting_files_changed: ${{ steps.changed-orch-alerting-files.outputs.any_changed }}
steps:
- name: Check out repository code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Get changed Java files
id: changed-java-files
uses: tj-actions/changed-files@934b2d2c7e653bb8c968afed5a0428617f09aa24 # v45.0.7
with:
# If you change the paths here, ensure they are synchronised with the paths in the other jobs.
# Find these by searching for "Ensure these are synchronized with the paths in the check-changed-files job"
files: |
**/src/**
**/*.java
**/*.gradle
**/*.properties
gradle*
gradle/**
- name: Get changed files in orchestration-alerting folder
id: changed-orch-alerting-files
uses: tj-actions/changed-files@934b2d2c7e653bb8c968afed5a0428617f09aa24 # v45.0.7
with:
files: |
orchestration-alerting/**
- name: Find PR comment
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: Comment added by Check Java Files Action
- name: Update java comment to indicate test skipping
if: github.event_name == 'pull_request' && steps.changed-java-files.outputs.any_changed == 'false'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Java Tests Skipped
No Java files were changed in this pull request. Java tests will be skipped[^1].
[^1]: These tests will still show as passing in the PR status check, but will not actually have run.
Any Java files that are changed in a subsequent commit will trigger the Java tests.
<!-- Comment added by Check Java Files Action -->
edit-mode: replace
- name: Update java comment to indicate test running
if: github.event_name == 'pull_request' && steps.changed-java-files.outputs.any_changed == 'true' && steps.fc.outputs.comment-id != 0
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Java Tests Not Skipped
Java files were previously skipped in this pull request. Subsequent changes have caused the tests to be run.
<!-- Comment added by Check Java Files Action -->
edit-mode: replace
- name: Add a warning to the job output if no Java files have changed
if: steps.changed-java-files.outputs.any_changed == 'false'
run: echo "::notice title=Java tests skipped::No Java files have changed in this pull request. Java tests will not be run (but will still show as passing)"