@@ -28,27 +28,43 @@ jobs:
2828 ref : main # This is the branch the PR is to be created from
2929 persist-credentials : true # make the token that is used the GITHUB_TOKEN, instead of your personal token
3030 fetch-depth : 0 # otherwise, you will failed to push refs to dest repo
31-
31+ - name : Store vars
32+ id : vars
33+ run : |
34+ echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
35+ echo "branch_name=automated-updates/update-poetry-lock" >> $GITHUB_OUTPUT
36+ - name : Create branch
37+ run : git checkout -b ${{ steps.vars.outputs.branch_name }}
3238 - uses : actions/setup-python@v2
3339 with :
3440 python-version : ${{ env.PYTHON_VERSION }}
3541 - uses : Gr1N/setup-poetry@v8
3642 with :
3743 poetry-version : ${{ env.POETRY_VERSION }}
44+ - name : Configure git user
45+ # https://github.com/actions/checkout/discussions/479
46+ run : |
47+ git config user.name "github-actions[bot]"
48+ git config user.email "github-actions[bot]@users.noreply.github.com"
3849 - name : Check for lock changes
3950 run : |
4051 poetry lock
52+ git commit -am "Update poetry lock file" || exit 0
4153 poetry install
4254 poetry run ni-python-styleguide fix
55+ git commit -am "Update formatting" || true
56+ git push --force --set-upstream origin ${{ steps.vars.outputs.branch_name }}
57+ # based on https://stackoverflow.com/a/73340290/8100990
4358 - name : Create Pull Request
44- uses : peter-evans/create-pull-request@v4
45- with :
46- commit-message : Update poetry lock and reformat
47- title : Update Poetry Lock
48- branch : aotumated-updates/update-poetry-lock
49- branch-suffix : short-commit-hash
50- body : |
51- # Update Poetry Lock
52- Ran poetry lock, install, then ni-python-styleguide fix to reformat any changes.
53- base : main
54- delete-branch : true
59+ run : |
60+ gh pr create -B main -H ${{ steps.vars.outputs.branch_name }} --title 'Update poetry lock and reformat' --body '# Update Poetry Lock
61+
62+ Ran:
63+ * `poetry lock`,
64+ * `poetry install`, then
65+ * `ni-python-styleguide fix` to reformat any changes.
66+
67+ \-\-\-
68+ Created by Github action'
69+ env :
70+ GH_TOKEN : ${{ github.token }}
0 commit comments