Skip to content

Commit

Permalink
ci: fix GitHub Actions workflow to run on contributors' pull requests (
Browse files Browse the repository at this point in the history
…#600)

- ci: skip jobs with the same content
  • Loading branch information
andreoliwa committed May 29, 2023
1 parent 45f9f63 commit 3df4038
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,26 @@

name: Python

on: [push]
on: [push, pull_request]

jobs:
# Adapted from https://github.com/marketplace/actions/skip-duplicate-actions
pre_job:
# continue-on-error: true # TODO: Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# https://github.com/marketplace/actions/skip-duplicate-actions#skip-concurrent-workflow-runs
concurrent_skipping: "same_content_newer"

build:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
name: "${{ matrix.python-version }} ${{ matrix.os }}"
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion src/nitpick/resources/python/github-workflow.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ url = "https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-gi

[".github/workflows/python.yaml"]
name = "Python"
on = ["push"]
on = ["push", "pull_request"]

[".github/workflows/python.yaml".jobs.build.strategy]
fail-fast = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Python
on:
- push
- pull_request
jobs:
build:
strategy:
Expand Down

0 comments on commit 3df4038

Please sign in to comment.