Skip to content

Commit

Permalink
Merge pull request #441 from joke2k/feature/rework-ci
Browse files Browse the repository at this point in the history
Rework trigger workflows strategy
  • Loading branch information
sergeyklay committed Mar 1, 2023
2 parents d307861 + 998ad13 commit 227db14
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 35 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Build

on:
push:
branches:
- develop
- main
- 'feature/**'
- 'release/**'
- 'fix/**'
branches-ignore:
# These should always correspond to pull requests, so ignore them for
# the push trigger and let them be triggered by the pull_request
# trigger, avoiding running the workflow twice. This is a minor
# optimization so there's no need to ensure this is comprehensive.
- 'dependabot/**'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

Expand All @@ -32,10 +32,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3.3.0

- name: Set up Python 3.10
uses: actions/setup-python@v4.1.0
uses: actions/setup-python@v4.5.0
with:
python-version: '3.10'

Expand Down Expand Up @@ -72,10 +72,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3.3.0

- name: Set up Python 3.10
uses: actions/setup-python@v4.1.0
uses: actions/setup-python@v4.5.0
with:
python-version: '3.10'

Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/change-pr-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Make sure new PRs are sent to develop

on:
pull_request_target:
types: [opened, edited]

jobs:
check-branch:
runs-on: ubuntu-latest
steps:
- uses: Vankka/pr-target-branch-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target: main
exclude: develop # Don't prevent going from develop -> main
change-to: develop
comment: |
Your PR was set to target `main`, PRs should be target `develop`
The base branch of this PR has been automatically changed to `develop`, please check that there are no merge conflicts.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: CI

on:
push:
branches:
- develop
- main
- 'feature/**'
- 'release/**'
- 'fix/**'
branches-ignore:
# These should always correspond to pull requests, so ignore them for
# the push trigger and let them be triggered by the pull_request
# trigger, avoiding running the workflow twice. This is a minor
# optimization so there's no need to ensure this is comprehensive.
- 'dependabot/**'

# The branches below must be a subset of the branches above
pull_request:
Expand Down Expand Up @@ -68,12 +68,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3.3.0
with:
fetch-depth: 5

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4.1.0
uses: actions/setup-python@v4.5.0
with:
python-version: ${{ matrix.python }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v3.3.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: CS

on:
push:
branches:
- develop
- main
- 'feature/**'
- 'release/**'
- 'fix/**'
branches-ignore:
# These should always correspond to pull requests, so ignore them for
# the push trigger and let them be triggered by the pull_request
# trigger, avoiding running the workflow twice. This is a minor
# optimization so there's no need to ensure this is comprehensive.
- 'dependabot/**'

pull_request:
branches:
Expand All @@ -25,10 +25,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3.3.0

- name: Set up Python 3.10
uses: actions/setup-python@v4.1.0
uses: actions/setup-python@v4.5.0
with:
python-version: '3.10'

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Docs

on:
push:
branches:
- develop
- main
- 'feature/**'
- 'release/**'
- 'fix/**'
branches-ignore:
# These should always correspond to pull requests, so ignore them for
# the push trigger and let them be triggered by the pull_request
# trigger, avoiding running the workflow twice. This is a minor
# optimization so there's no need to ensure this is comprehensive.
- 'dependabot/**'

# The branches below must be a subset of the branches above
pull_request:
Expand All @@ -26,10 +26,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3.3.0

- name: Set up Python 3.10
uses: actions/setup-python@v4.1.0
uses: actions/setup-python@v4.5.0
with:
python-version: '3.10'

Expand Down

0 comments on commit 227db14

Please sign in to comment.