diff --git a/.github/workflows/external_pr.yml b/.github/workflows/external_pr.yml new file mode 100644 index 0000000..c0365ef --- /dev/null +++ b/.github/workflows/external_pr.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml index bc5c277..c2cf8b5 100644 --- a/.github/workflows/isort.yml +++ b/.github/workflows/isort.yml @@ -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 \ No newline at end of file + - uses: isort/isort-action@v1.1.0 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7c9c3d0..5bbc4da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9ab7c76..2d3e58c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -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/PRConventionalCommits@1.2.0 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"