Skip to content

Commit

Permalink
only commit and make automerge pr if there are changes
Browse files Browse the repository at this point in the history
otherwise this workflow would fail in the rare case that no dependencies update within a month
  • Loading branch information
richardsheridan committed Mar 7, 2023
1 parent b574e60 commit aedbc7d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/autodeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,23 @@ jobs:
run: |
python -m pip install -r test-requirements.txt # may contain new black ver
black setup.py trio
- name: Commit changes
- name: Commit changes and create automerge PR
env:
GH_TOKEN: ${{ github.token }}
run: |
# https://stackoverflow.com/a/3879077/4504950
if ! git diff-index --quiet HEAD; then
echo "No changes to commit!"
exit 0
fi
# setup git repo
git switch --force-create autodeps/bump_from_${GITHUB_SHA:0:6}
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git commit -am "Dependency updates"
git push --force --set-upstream origin autodeps/bump_from_${GITHUB_SHA:0:6}
- name: Make automerge PR
env:
GH_TOKEN: ${{ github.token }}
run: |
# git push returns before github is ready for a pr, we have to poll until success
for BACKOFF in 1 2 4 8 15 15 15 15 0; do
sleep $BACKOFF
Expand Down

0 comments on commit aedbc7d

Please sign in to comment.