forked from quokka-astro/quokka
-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (116 loc) · 4.73 KB
/
Copy pathcheck_changes.yml
File metadata and controls
120 lines (116 loc) · 4.73 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: 🔍 Check Changes
on:
workflow_call:
inputs:
workflow_file:
description: "Specific workflow file to check for changes (optional)"
required: false
type: string
outputs:
has_docs_changes:
value: ${{ jobs.check.outputs.has_docs_changes }}
has_non_docs_changes:
value: ${{ jobs.check.outputs.has_non_docs_changes }}
has_scripts_changes:
value: ${{ jobs.check.outputs.has_scripts_changes }}
has_cpp_changes:
value: ${{ jobs.check.outputs.has_cpp_changes }}
has_py_changes:
value: ${{ jobs.check.outputs.has_py_changes }}
has_api_docs_changes:
value: ${{ jobs.check.outputs.has_api_docs_changes }}
has_workflow_changes:
value: ${{ jobs.check.outputs.has_workflow_changes }}
has_specific_workflow_changes:
value: ${{ jobs.check.outputs.has_specific_workflow_changes }}
jobs:
check:
runs-on: ubuntu-latest
outputs:
has_docs_changes: ${{ steps.set-output.outputs.has_docs_changes }}
has_non_docs_changes: ${{ steps.set-output.outputs.has_non_docs_changes }}
has_scripts_changes: ${{ steps.set-output.outputs.has_scripts_changes }}
has_cpp_changes: ${{ steps.set-output.outputs.has_cpp_changes }}
has_py_changes: ${{ steps.set-output.outputs.has_py_changes }}
has_api_docs_changes: ${{ steps.set-output.outputs.has_api_docs_changes }}
has_workflow_changes: ${{ steps.set-output.outputs.has_workflow_changes }}
has_specific_workflow_changes: ${{ steps.set-output.outputs.has_specific_workflow_changes }}
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
id: changes
with:
filters: |
docs:
- 'docs/**'
scripts:
- 'scripts/**'
code:
- 'src/**'
- 'extern/amrex/**'
- 'extern/Microphysics/**'
- 'extern/fmt/**'
- 'extern/grackle_data_files/**'
- 'extern/openPMD-api/**'
- 'extern/yaml-cpp/**'
- 'extern/turbulence/**'
- 'inputs/**'
- 'CMakeLists.txt'
- '**/*.cpp'
- '**/*.c'
- '**/*.hpp'
- '**/*.h'
- '.gitmodules'
cpp:
- '**/*.cpp'
- '**/*.c'
- '**/*.hpp'
- '**/*.h'
py:
- '**/*.py'
- '**/*.ipynb'
api_docs:
- 'src/**'
- 'README.md'
- 'docs/Doxyfile'
- 'docs/markdown/api_reference.md'
- 'scripts/bash/docs_api_build.sh'
workflows:
- '.github/workflows/**/*.yml'
- '.github/workflows/**/*.yaml'
specific_workflow:
- '${{ inputs.workflow_file }}'
- '.github/workflows/dockerfiles/ROCm-DiskGalaxy/**'
- id: set-output
env:
DOCS_CHANGED: ${{ steps.changes.outputs.docs }}
SCRIPTS_CHANGED: ${{ steps.changes.outputs.scripts }}
CPP_CHANGED: ${{ steps.changes.outputs.cpp }}
PY_CHANGED: ${{ steps.changes.outputs.py }}
API_DOCS_CHANGED: ${{ steps.changes.outputs.api_docs }}
WORKFLOW_CHANGED: ${{ steps.changes.outputs.workflows }}
SPECIFIC_WORKFLOW_CHANGED: ${{ steps.changes.outputs.specific_workflow }}
CODE_CHANGED: ${{ steps.changes.outputs.code }}
WORKFLOW_FILE: ${{ inputs.workflow_file }}
run: |
echo "has_docs_changes=$DOCS_CHANGED" >> "$GITHUB_OUTPUT"
echo "has_scripts_changes=$SCRIPTS_CHANGED" >> "$GITHUB_OUTPUT"
echo "has_cpp_changes=$CPP_CHANGED" >> "$GITHUB_OUTPUT"
echo "has_py_changes=$PY_CHANGED" >> "$GITHUB_OUTPUT"
echo "has_api_docs_changes=$API_DOCS_CHANGED" >> "$GITHUB_OUTPUT"
echo "has_workflow_changes=$WORKFLOW_CHANGED" >> "$GITHUB_OUTPUT"
echo "has_specific_workflow_changes=$SPECIFIC_WORKFLOW_CHANGED" >> "$GITHUB_OUTPUT"
# Calculate has_non_docs_changes based on code changes OR specific workflow changes (if specified)
if [ -n "$WORKFLOW_FILE" ]; then
if [ "$CODE_CHANGED" = "true" ] || [ "$SPECIFIC_WORKFLOW_CHANGED" = "true" ]; then
echo "has_non_docs_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_non_docs_changes=false" >> "$GITHUB_OUTPUT"
fi
else
if [ "$CODE_CHANGED" = "true" ] || [ "$WORKFLOW_CHANGED" = "true" ]; then
echo "has_non_docs_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_non_docs_changes=false" >> "$GITHUB_OUTPUT"
fi
fi