Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate steps to bump version in pull request action into a separate job #342

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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