[workflows]: Remove silliness
This commit is contained in:
21
.github/workflows/ci.yml
vendored
21
.github/workflows/ci.yml
vendored
@ -4,9 +4,13 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths:
|
||||||
|
- "**.py"
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths:
|
||||||
|
- "**.py"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_python_changes:
|
check_python_changes:
|
||||||
@ -18,22 +22,11 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Determine Previous Commit
|
|
||||||
id: get_previous_commit
|
|
||||||
run: |
|
|
||||||
if [ -z "${{ github.event.before }}" ] || [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
|
|
||||||
echo "No previous commit found. Assuming first commit."
|
|
||||||
echo "PREV_COMMIT=$(git rev-list --max-parents=0 HEAD)" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "Using previous commit from GitHub event."
|
|
||||||
echo "PREV_COMMIT=${{ github.event.before }}" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Check if Python files changed
|
- name: Check if Python files changed
|
||||||
id: check_files
|
id: check_files
|
||||||
run: |
|
run: |
|
||||||
git fetch origin $PREV_COMMIT
|
git fetch origin ${{ github.event.before }}
|
||||||
if git diff --name-only $PREV_COMMIT ${{ github.sha }} | grep -q '\.py$'; then
|
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '\.py$'; then
|
||||||
echo "Python files changed"
|
echo "Python files changed"
|
||||||
echo "run_tests=true" >> $GITHUB_ENV
|
echo "run_tests=true" >> $GITHUB_ENV
|
||||||
echo "::set-output name=run_tests::true"
|
echo "::set-output name=run_tests::true"
|
||||||
@ -89,7 +82,7 @@ jobs:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: test
|
needs: test
|
||||||
if: success() || needs.check_python_changes.outputs.run_tests == 'false'
|
if: success() || needs.check_python_changes.outputs.run_tests == 'false' # Deploy if tests pass OR no Python changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
|
Reference in New Issue
Block a user