mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-13 19:21:50 +02:00
ci: don't duplicate push & PR
This commit is contained in:
27
.github/workflows/check_pr.yml
vendored
Normal file
27
.github/workflows/check_pr.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
outputs:
|
||||||
|
branch-pr:
|
||||||
|
description: The PR number if the branch is in one
|
||||||
|
value: ${{ jobs.pr.outputs.branch-pr }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pr:
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
outputs:
|
||||||
|
branch-pr: ${{ steps.script.outputs.result }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/github-script@v7
|
||||||
|
id: script
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const prs = await github.rest.pulls.list({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
head: context.repo.owner + ':${{ github.ref_name }}'
|
||||||
|
})
|
||||||
|
if (prs.data.length) {
|
||||||
|
console.log(`::notice ::Skipping CI on branch push as it is already run in PR #${prs.data[0]["number"]}`)
|
||||||
|
return prs.data[0]["number"]
|
||||||
|
}
|
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@ -5,16 +5,27 @@ permissions:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check_pr_status:
|
||||||
|
uses: ./.github/workflows/check_pr.yml
|
||||||
|
|
||||||
formatter:
|
formatter:
|
||||||
|
needs: check_pr_status
|
||||||
|
if: needs.check_pr_status.outputs.branch-pr == ''
|
||||||
uses: ./.github/workflows/formatter.yml
|
uses: ./.github/workflows/formatter.yml
|
||||||
|
|
||||||
unit-test:
|
unit-test:
|
||||||
|
needs: check_pr_status
|
||||||
|
if: needs.check_pr_status.outputs.branch-pr == ''
|
||||||
uses: ./.github/workflows/pytest.yml
|
uses: ./.github/workflows/pytest.yml
|
||||||
secrets:
|
secrets:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
unit-test-matrix:
|
unit-test-matrix:
|
||||||
|
needs: check_pr_status
|
||||||
|
if: needs.check_pr_status.outputs.branch-pr == ''
|
||||||
uses: ./.github/workflows/pytest-matrix.yml
|
uses: ./.github/workflows/pytest-matrix.yml
|
||||||
|
|
||||||
end2end-test:
|
end2end-test:
|
||||||
|
needs: check_pr_status
|
||||||
|
if: needs.check_pr_status.outputs.branch-pr == ''
|
||||||
uses: ./.github/workflows/end2end-conda.yml
|
uses: ./.github/workflows/end2end-conda.yml
|
Reference in New Issue
Block a user