Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5b31c2e

Browse filesBrowse files
committed
Only run GHA if project files are modified
There is no need to run the test suite when docs files are modified.
1 parent 757ada6 commit 5b31c2e
Copy full SHA for 5b31c2e

File tree

2 files changed

+46
-23
lines changed
Filter options

2 files changed

+46
-23
lines changed

‎.github/workflows/python-testing.yml

Copy file name to clipboardExpand all lines: .github/workflows/python-testing.yml
+45-22Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,81 @@
11
---
22
name: Python
33

4+
# HINT: Sync this paths with the egrep in step check_files
45
on:
56
push:
67
branches: [ "master", "main" ]
78
paths:
89
- 'pyproject.toml'
10+
- 'setup.cfg'
911
- '**.py'
10-
- '.github/workflows/python-testing.yml'
12+
- '.github/workflows/*.yml'
1113

1214
pull_request:
1315
branches: [ "master", "main" ]
1416
paths:
1517
- 'pyproject.toml'
18+
- 'setup.cfg'
1619
- '**.py'
17-
- '.github/workflows/python-testing.yml'
20+
- '.github/workflows/*.yml'
1821

1922
permissions:
2023
contents: read
2124

2225
concurrency:
2326
# only cancel in-progress runs of the same workflow
2427
group: ${{ github.workflow }}-${{ github.ref }}
25-
# ${{ github.head_ref || github.run_id }}
2628
cancel-in-progress: true
2729

2830

2931
jobs:
32+
check-files:
33+
runs-on: ubuntu-latest
34+
outputs:
35+
can_run: ${{ steps.check_files.outputs.can_run }}
36+
37+
steps:
38+
- uses: actions/checkout@v3
39+
with:
40+
fetch-depth: 0
41+
42+
- name: GitHub variables
43+
id: gh-vars
44+
run: |
45+
for var in GITHUB_WORKFLOW GITHUB_ACTION GITHUB_ACTIONS GITHUB_REPOSITORY GITHUB_EVEN_NAME GITHUB_EVENT_PATH GITHUB_WORKSPACE GITHUB_SHA GITHUB_REF GITHUB_HEAD_REF GITHUB_BASE_REF; do
46+
echo "$var = ${!var}"
47+
done
48+
49+
- name: Check for file changes
50+
id: check_files
51+
run: |
52+
can_run=$(git diff --name-only ${{ github.event.after }} ${{ github.event.before }} | \
53+
egrep -q '.github/workflows/|pyproject.toml|setup.cfg|\.py$' && echo 1 || echo 0)
54+
echo "can_run=$can_run" >> $GITHUB_OUTPUT
55+
56+
skip_test:
57+
runs-on: ubuntu-latest
58+
needs: check-files
59+
timeout-minutes: 2
60+
if: ${{ needs.check-files.outputs.can_run == '0' }}
61+
62+
steps:
63+
- name: Skip test
64+
run: |
65+
echo "Nothing to do as no TOML, Python, or YAML file has been changed.
66+
"
67+
echo "Skipping."
68+
3069
check:
3170
runs-on: ubuntu-latest
71+
needs: check-files
3272
# Timout of 15min
3373
timeout-minutes: 15
74+
# needs.check-files.outputs.can_run
75+
if: ${{ needs.check-files.outputs.can_run == '1' }}
3476

3577
steps:
3678
- uses: actions/checkout@v3
37-
- name: Output env variables
38-
run: |
39-
echo "Default branch=${default-branch}"
40-
echo "GITHUB_WORKFLOW=${GITHUB_WORKFLOW}"
41-
echo "GITHUB_ACTION=$GITHUB_ACTION"
42-
echo "GITHUB_ACTIONS=$GITHUB_ACTIONS"
43-
echo "GITHUB_ACTOR=$GITHUB_ACTOR"
44-
echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY"
45-
echo "GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME"
46-
echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH"
47-
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
48-
echo "GITHUB_SHA=$GITHUB_SHA"
49-
echo "GITHUB_REF=$GITHUB_REF"
50-
echo "GITHUB_HEAD_REF=$GITHUB_HEAD_REF"
51-
echo "GITHUB_BASE_REF=$GITHUB_BASE_REF"
52-
echo "::debug::---Start content of file $GITHUB_EVENT_PATH"
53-
cat $GITHUB_EVENT_PATH
54-
echo "\n"
55-
echo "::debug::---end"
5679
- name: Set up Python ${{ matrix.python-version }}
5780
uses: actions/setup-python@v4
5881
with:

‎README.rst

Copy file name to clipboardExpand all lines: README.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Quickstart
33

44
.. teaser-begin
55
6-
A Python module for `semantic versioning`_. Simplifies comparing versions.
6+
A Python module to simplify `semantic versioning`_.
77

88
|GHAction| |python-support| |downloads| |license| |docs| |black|
99
|openissues| |GHDiscussion|

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.