Skip to content

Commit

Permalink
Separate steps to bump version in pull request action into a separate…
Browse files Browse the repository at this point in the history
… job (#342)
  • Loading branch information
emilejq authored Oct 31, 2023
1 parent 9454cf3 commit 8a6d1e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Dr Header Pull Request handler
name: Pull Request Handler

on: pull_request

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -8,15 +10,15 @@ jobs:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout Code
- name: Checkout code
uses: actions/[email protected]

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

- name: Install PIP Dependencies
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements_dev.txt
Expand All @@ -41,23 +43,30 @@ jobs:
- name: Run SCA scan
run: tox run -e sca

- name: Checkout origin branch if PR 'to-branch' is master
if: github.base_ref == 'master'
bump-version:
if: github.base_ref == 'master'
needs: build

runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
pip install bump2version==1.0.1
- name: Checkout head branch
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}

- name: BumpVersion if PR 'to-branch' is master
if: github.base_ref == 'master'
- name: Bump version
run: |
grep -i 'current_version = ' setup.cfg | head -1 | tr -d 'current_version = '
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
bump2version minor
grep -i 'current_version = ' setup.cfg | head -1 | tr -d 'current_version = '
- name: Push changes if PR 'to-branch' is master
if: github.base_ref == 'master'
- name: Push changes to origin
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
bump2version==1.0.1
wheel==0.41.3
watchdog==3.0.0
tox==4.11.3
Expand Down

0 comments on commit 8a6d1e9

Please sign in to comment.