Skip to content

Commit

Permalink
fix: add external_pr.yml and fix pull_request.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
drodarie committed Oct 7, 2024
1 parent a60af7c commit c5c1059
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 24 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/external_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Validate external Pull Request

on:
pull_request:
types: [opened, synchronize, reopened]

env:
LOCAL_PR: ${{ github.event.pull_request.head.repo.full_name == github.repository }}

jobs:
variables: # env variables are not accessible through job.if (https://stackoverflow.com/q/73558652)
runs-on: ubuntu-latest
outputs:
LOCAL_PR: ${{ steps.init.outputs.LOCAL_PR }}
steps:
- name: Make environment variables global
id: init
run: |
echo "LOCAL_PR=${{ env.LOCAL_PR }}" >> $GITHUB_OUTPUT
isort:
needs: variables
# if PR is external, trigger the tests on push or new PR
if: ${{ needs.variables.outputs.LOCAL_PR == 'false'}}
uses: ./.github/workflows/isort.yml
black:
needs: variables
if: ${{ needs.variables.outputs.LOCAL_PR == 'false' }}
uses: ./.github/workflows/black.yml
build:
needs: variables
if: ${{ needs.variables.outputs.LOCAL_PR == 'false' }}
uses: ./.github/workflows/build.yml
docs:
needs: variables
if: ${{ needs.variables.outputs.LOCAL_PR == 'false' }}
uses: ./.github/workflows/docs.yml
2 changes: 1 addition & 1 deletion .github/workflows/isort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
sudo apt install openmpi-bin libopenmpi-dev
# Install dependencies for proper 1st/2nd/3rd party import sorting
- run: pip install -e .[parallel]
- uses: isort/isort-action@master
- uses: isort/isort-action@v1.1.0
4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ jobs:
uses: ./.github/workflows/build.yml
docs:
uses: ./.github/workflows/docs.yml
api:
uses: ./.github/workflows/api.yml

tag_release:
needs: [isort, black, build, docs, api]
needs: [isort, black, build, docs]
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.semver.outputs.next }}
Expand Down
24 changes: 4 additions & 20 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
name: Validate Pull Request
name: Validate Pull Request Name

on:
pull_request:
types: [opened, synchronize, reopened, edited]
types: [edited, opened, reopened]

jobs:
validate-pr-title:
# Trigger only for local PR when PR is edited (title, description, etc.)
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- name: PR Conventional Commit Validation
uses: ytanikin/[email protected]
with:
task_types: '["feat","fix","docs","test","ci","refactor","perf","revert"]'

preview-docs:
runs-on: ubuntu-latest
if: github.event.action != 'edited'
steps:
- uses: actions/checkout@v4
- name: Check modifications on docs
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs: # name of the filter
- 'docs/**'
- name: Preview Readthedocs
if: steps.filter.outputs.docs == 'true'
uses: readthedocs/actions/preview@v1
with:
project-slug: "bsb"

0 comments on commit c5c1059

Please sign in to comment.