Skip to content

Commit

Permalink
Add event conditions for certain steps
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Aug 12, 2023
1 parent acafbae commit 90dad90
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ jobs:
with:
python-version: '3.9'

# Runs only when the event is NOT a release, as the condition is not necessary when it is
- name: Check for changes in the package
id: check-changes
if: github.event_name != 'release'
run: |
files_changed=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}")
echo "Changes: ${files_changed}"
Expand All @@ -34,8 +35,9 @@ jobs:
echo "No changes were found in package. Skipping pytest."
fi
# Runs when the event is a release or when there are changes in the package
- name: Install dependencies and run pytest
if: env.changes_in_folder == 'true'
if: github.event_name == 'release' || env.changes_in_folder == 'true'
run: |
python -m pip install --upgrade pip
pip install pytest
Expand Down

0 comments on commit 90dad90

Please sign in to comment.