-
Notifications
You must be signed in to change notification settings - Fork 145
62 lines (52 loc) · 2.31 KB
/
checks-vizro-core.yml
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
name: Checks for Vizro
defaults:
run:
working-directory: vizro-core
on:
push:
branches: [main]
paths:
- "vizro-core/**"
pull_request:
branches:
- "main"
paths:
- "vizro-core/**"
env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1
PYTHON_VERSION: "3.12"
jobs:
checks-vizro-core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Use fetch-depth of 2 to enable the changelog fragment check, which only runs in a pull request, not on push.
# See https://stackoverflow.com/questions/74265821/get-modified-files-in-github-actions
fetch-depth: 2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Hatch
run: pip install hatch
- name: Show dependency tree
run: hatch run pip tree
- name: Check schema is up to date
run: hatch run schema-check
- name: Find changed files to see if changelog fragment needed
id: changed-files
if: ${{ github.event_name == 'pull_request' }}
# --no-renames is required so that an empty changelog file added in a release PR always counts as added rather
# than a renamed version of an already-existing empty changelog file.
run: |
echo "changelog_fragment_added=$(git diff --name-only --no-renames --diff-filter=A HEAD^1 HEAD -- 'changelog.d/*.md' | xargs)" >> $GITHUB_OUTPUT
echo "source_code_changed=$(git diff --name-only HEAD^1 HEAD -- 'src' | xargs)" >> $GITHUB_OUTPUT
- name: Fail if changelog fragment needed and wasn't added
if: ${{ steps.changed-files.outcome != 'skipped' && steps.changed-files.outputs.source_code_changed && !steps.changed-files.outputs.changelog_fragment_added}}
run: |
echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run changelog:add' to create such a fragment."
echo "If your PR contains changes that should be mentioned in the CHANGELOG in the next release, please uncomment the relevant section in your created fragment and describe the changes to the user."
echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as is."
exit 1