Skip to content

Commit

Permalink
Avoid duplicated Actions runs and deploy only from main (#580)
Browse files Browse the repository at this point in the history
Update run conditions for GitHub Actions. Run GitHub Actions on every
Pull Request and only on pushes to `main` branch. This avoids having
duplicated runs in every PR: one because it's a PR and one because it's
a push to a branch. Add condition to deploy GitHub Pages only if the
built came from a push to `main`.
  • Loading branch information
santisoler authored Dec 4, 2024
1 parent e2b5bcf commit b2cecdb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
name: EM Website Build

on:
pull_request:
push:
branches:
- '*'
pull_request:
branches: [ main ]
- main

jobs:
test:
Expand Down Expand Up @@ -53,6 +52,10 @@ jobs:
python _ext/copy_images.py
- name: GitHub Pages
# Only deploy if the event that triggered was a push to main
# (only pushes to main triggers builds, see 'on' condition in the
# beginning of the file)
if: success() && github.event_name == 'push'
uses: crazy-max/[email protected]
with:
build_dir: _build/html
Expand Down

0 comments on commit b2cecdb

Please sign in to comment.