Skip to content

Commit 0c0a2b3

Browse files
authored
Check changed files before running gradle check (opensearch-project#13498)
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
1 parent 45360db commit 0c0a2b3

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/gradle-check.yml

+26-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,28 @@ permissions:
1212
contents: read # to fetch code (actions/checkout)
1313

1414
jobs:
15+
check-files:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
RUN_GRADLE_CHECK: ${{ steps.changed-files-specific.outputs.any_changed }}
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Get changed files
22+
id: changed-files-specific
23+
uses: tj-actions/changed-files@v44
24+
with:
25+
files_ignore: |
26+
release-notes/*.md
27+
.github/**
28+
*.md
29+
1530
gradle-check:
16-
if: github.repository == 'opensearch-project/OpenSearch'
31+
needs: check-files
32+
if: github.repository == 'opensearch-project/OpenSearch' && needs.check-files.outputs.RUN_GRADLE_CHECK == 'true'
1733
permissions:
1834
contents: read # to fetch code (actions/checkout)
1935
pull-requests: write # to create or update comment (peter-evans/create-or-update-comment)
2036
issues: write # To create an issue if check fails on push.
21-
2237
runs-on: ubuntu-latest
2338
timeout-minutes: 130
2439
steps:
@@ -151,3 +166,12 @@ jobs:
151166
with:
152167
assignees: ${{ github.event.head_commit.author.username }}, ${{ github.triggering_actor }}
153168
filename: .github/ISSUE_TEMPLATE/failed_check.md
169+
170+
check-result:
171+
needs: [check-files, gradle-check]
172+
if: always()
173+
runs-on: ubuntu-latest
174+
steps:
175+
- name: Fail if gradle-check fails
176+
if: ${{ needs.check-files.outputs.RUN_GRADLE_CHECK && needs.gradle-check.result == 'failure' }}
177+
run: exit 1

0 commit comments

Comments
 (0)