Skip to content

Commit

Permalink
Merge pull request #437 from tomvothecoder/devops/436-doc-only-prs
Browse files Browse the repository at this point in the history
Add ability for CI to skip required jobs to save build time and resources
  • Loading branch information
tomvothecoder authored Apr 8, 2021
2 parents 7a446db + b3b30fc commit cd85249
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/build_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,27 @@ name: CI/CD Build Workflow
on:
push:
branches: [master]
paths-ignore: ["docs/**"]

pull_request:
branches: [master]
paths-ignore: ["docs/**"]

env:
UVCDAT_ANONYMOUS_LOG: False

jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
paths_ignore: '["**/README.md", "**/docs/**", "**/examples/**", "**/misc/**"]'

pre-commit-hooks:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
Expand All @@ -32,6 +42,8 @@ jobs:
uses: pre-commit/action@v2.0.0

build:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -79,8 +91,8 @@ jobs:
bash tests/test.sh
publish-docs:
if: github.event_name == 'push'
needs: [pre-commit-hooks, build]
needs: [pre_job, pre-commit-hooks, build]
if: ${{ needs.pre_job.outputs.should_skip != 'true' && github.event_name == 'push' }}
runs-on: ubuntu-latest
defaults:
run:
Expand Down

0 comments on commit cd85249

Please sign in to comment.