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

Use native gh tooling to raise pr #138

Merged
merged 3 commits into from
Aug 28, 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
3 changes: 0 additions & 3 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
- pyproject.toml
- docs/Coding-Conventions.md
- .github/workflows/PR.yml
types:
- opened
- synchronize

env:
POETRY_VERSION: 1.2.2
Expand Down
40 changes: 28 additions & 12 deletions .github/workflows/Update-Poetry-Lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,43 @@ jobs:
ref: main # This is the branch the PR is to be created from
persist-credentials: true # make the token that is used the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

- name: Store vars
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "branch_name=automated-updates/update-poetry-lock" >> $GITHUB_OUTPUT
- name: Create branch
run: git checkout -b ${{ steps.vars.outputs.branch_name }}
- uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: Gr1N/setup-poetry@v8
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Configure git user
# https://github.com/actions/checkout/discussions/479
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Check for lock changes
run: |
poetry lock
git commit -am "Update poetry lock file" || exit 0
poetry install
poetry run ni-python-styleguide fix
git commit -am "Update formatting" || true
git push --force --set-upstream origin ${{ steps.vars.outputs.branch_name }}
# based on https://stackoverflow.com/a/73340290/8100990
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: Update poetry lock and reformat
title: Update Poetry Lock
branch: aotumated-updates/update-poetry-lock
branch-suffix: short-commit-hash
body: |
# Update Poetry Lock
Ran poetry lock, install, then ni-python-styleguide fix to reformat any changes.
base: main
delete-branch: true
run: |
gh pr create -B main -H ${{ steps.vars.outputs.branch_name }} --title 'Update poetry lock and reformat' --body '# Update Poetry Lock

Ran:
* `poetry lock`,
* `poetry install`, then
* `ni-python-styleguide fix` to reformat any changes.

\-\-\-
Created by Github action'
env:
GH_TOKEN: ${{ github.token }}
Loading