Skip to content

Commit e560c71

Browse files
committed
f
1 parent e32e3f7 commit e560c71

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/lint.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,63 @@ jobs:
1616
name: Test changed-files
1717
steps:
1818
- uses: actions/checkout@v4
19+
20+
# -----------------------------------------------------------------------------------------------------------
21+
# Example 1
22+
# -----------------------------------------------------------------------------------------------------------
23+
- name: Get changed files
24+
id: changed-files
25+
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
26+
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g
27+
# with:
28+
# since_last_remote_commit: true
29+
30+
- name: List all changed files
31+
env:
32+
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
33+
run: |
34+
for file in ${ALL_CHANGED_FILES}; do
35+
echo "$file was changed"
36+
done
37+
38+
# -----------------------------------------------------------------------------------------------------------
39+
# Example 2
40+
# -----------------------------------------------------------------------------------------------------------
41+
- name: Get all changed markdown files
42+
id: changed-markdown-files
43+
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
44+
with:
45+
# Avoid using single or double quotes for multiline patterns
46+
files: |
47+
**.md
48+
docs/**.md
49+
50+
- name: List all changed files markdown files
51+
if: steps.changed-markdown-files.outputs.any_changed == 'true'
52+
env:
53+
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
54+
run: |
55+
for file in ${ALL_CHANGED_FILES}; do
56+
echo "$file was changed"
57+
done
58+
59+
# -----------------------------------------------------------------------------------------------------------
60+
# Example 3
61+
# -----------------------------------------------------------------------------------------------------------
1962
- name: Get all test, doc and src files that have changed
2063
id: changed-files-yaml
2164
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
65+
with:
66+
files_yaml: |
67+
doc:
68+
- '**.md'
69+
- docs/**
70+
test:
71+
- test/**
72+
- '!test/**.md'
73+
src:
74+
- src/**
75+
# Optionally set `files_yaml_from_source_file` to read the YAML from a file. e.g `files_yaml_from_source_file: .github/changed-files.yml`
2276

2377
- name: Run step if test file(s) change
2478
# NOTE: Ensure all outputs are prefixed by the same key used above e.g. `test_(...)` | `doc_(...)` | `src_(...)` when trying to access the `any_changed` output.
@@ -55,6 +109,22 @@ jobs:
55109
echo "One or more files in the docs folder has changed."
56110
echo "List all the files that have changed: $ALL_CHANGED_FILES"
57111
112+
- uses: actions/checkout@v2
113+
- uses: actions/setup-python@v3
114+
with:
115+
python-version: '3.x'
116+
- run: pip install mypy
117+
- name: Get Python changed files
118+
id: changed-py-files
119+
uses: tj-actions/changed-files@v23
120+
with:
121+
files: |
122+
*.py
123+
**/*.py
124+
- name: Run if any of the listed files above is changed
125+
if: steps.changed-py-files.outputs.any_changed == 'true'
126+
run: mypy ${{ steps.changed-py-files.outputs.all_changed_files }} --ignore-missing-imports
127+
58128

59129
lint:
60130
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)