Skip to content

Commit

Permalink
Merge pull request #414 from sentinel-hub/fix/github-action-checkout-…
Browse files Browse the repository at this point in the history
…branch

Fixed branch checkouts for scheduled events in GitHub action
  • Loading branch information
zigaLuksic committed Jun 2, 2022
2 parents 9b75d8f + 48c688e commit d6dc6ae
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/ci_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,38 @@ on:
schedule:
- cron: '0 0 * * *'

env:
# The only way to simulate if-else statement
CHECKOUT_BRANCH: ${{ github.event_name == 'push' && github.ref || 'develop' }}


jobs:

check-code-black:
runs-on: ubuntu-latest
steps:
- name: Check out current branch
if: github.event_name == 'push'
- name: Checkout branch
uses: actions/checkout@v2
with:
ref: ${{ env.CHECKOUT_BRANCH }}

- name: Check code compliance with black
if: github.event_name == 'push'
run: |
pip install black[jupyter]
black . --check --diff
check-code-isort:
runs-on: ubuntu-latest
steps:
- name: Check out current branch
if: github.event_name == 'push'
- name: Checkout branch
uses: actions/checkout@v2
with:
ref: ${{ env.CHECKOUT_BRANCH }}

- name: Check code compliance with isort
if: github.event_name == 'push'
run: |
pip install isort
isort **/*.py --check --diff
isort . --check --diff
test-on-github:
runs-on: ubuntu-latest
Expand All @@ -42,15 +47,10 @@ jobs:
- '3.8'
- '3.9'
steps:
- name: Check out current branch in case of a push event
if: github.event_name == 'push'
uses: actions/checkout@v2

- name: Check out develop branch in case of a scheduled event
if: github.event_name == 'schedule'
- name: Checkout branch
uses: actions/checkout@v2
with:
ref: develop
ref: ${{ env.CHECKOUT_BRANCH }}

- name: Setup Python
uses: actions/setup-python@v2
Expand Down

0 comments on commit d6dc6ae

Please sign in to comment.