Skip to content

Commit 6e05946

Browse files
committed
wip
1 parent 78fb623 commit 6e05946

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

.github/workflows/validate.yaml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ concurrency:
1414
jobs:
1515
validate:
1616
name: 'Validate Changed Packages'
17-
if: contains(github.event.pull_request.labels.*.name, 'full validation')
17+
if: github.event.action == 'labeled' && contains(github.event.pull_request.labels.*.name, 'full validation')
1818
runs-on: ubuntu-latest
1919

2020
steps:
@@ -46,6 +46,45 @@ jobs:
4646
-H "Accept: application/vnd.github.v3+json" \
4747
"https://api.github.com/repos/$REPO/issues/$PR_NUMBER/labels/${ENCODED_LABEL}"
4848
49+
static-check:
50+
name: 'See if Static Analysis should run'
51+
if: github.event.action == 'synchronize' || github.event.action == 'opened' || github.event.action == 'reopened'
52+
runs-on: ubuntu-latest
53+
54+
outputs:
55+
all-changed-files: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Get all changed files for this PR
63+
id: changed-files
64+
run: |
65+
# Simulating output for debugging purposes
66+
echo "all_changed_and_modified_files=file1.txt,file2.txt,file3.txt"
67+
echo "::set-output name=all-changed-files::file1.txt,file2.txt,file3.txt"
68+
69+
- name: List changed files, skipping this job if there are no files to analyze
70+
run: |
71+
if [ "${{ steps.changed-files.outputs.all_changed_and_modified_files }}" == "" ]; then
72+
echo 'No files eligible for scanning were changed. Skipping Static Analysis.'
73+
exit 0
74+
else
75+
echo ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
76+
fi
77+
78+
static:
79+
name: 'Run Static Analysis'
80+
runs-on: ubuntu-latest
81+
needs: static-check
82+
if: needs.static-check.outputs.all-changed-files != ''
83+
84+
steps:
85+
- name: Check the outputs to determine whether to fail
86+
run: echo "Running static analyzer"
87+
4988
# remove-label:
5089
# needs: validate
5190
# if: always() # Ensures this runs even if validation fails

0 commit comments

Comments
 (0)