From edabf1848fc93dd12685eb33d51c2b2f9e767d44 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Wed, 22 Jan 2025 09:24:48 +0100 Subject: [PATCH] Fix automatic dependency update --- .github/workflows/check-deps.sh | 54 -------------------------------- .github/workflows/check_deps.yml | 36 +++++++++++++++++---- 2 files changed, 30 insertions(+), 60 deletions(-) delete mode 100755 .github/workflows/check-deps.sh diff --git a/.github/workflows/check-deps.sh b/.github/workflows/check-deps.sh deleted file mode 100755 index 0439af3..0000000 --- a/.github/workflows/check-deps.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -e - -GITHUB_PR_LABEL="dependencies" -COMMIT_TITLE="Update dependencies" - -if [ -z "$BRANCH_NAME" ]; then - echo "Branch name is required" - exit 1 -fi - -function check_pr { - gh pr list --state open --label "$GITHUB_PR_LABEL" -} - -git config user.name "${GITHUB_ACTOR}" -git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - -_update_output="$(TERM=dumb rebar3 update-deps --replace)" - -if git diff --exit-code --quiet; then - echo "No changes to the dependencies" - exit 0 -else - echo "Detected changes to dependencies, reformatting as well" - rebar3 fmt --write -fi - -git checkout -b "$BRANCH_NAME" -git add . - -git commit -F- < /tmp/pr-body.md + Output of running \`rebar3 update-deps\`: + + \``` + $_update_output + \``` + EOF + + rebar3 fmt --write + + # We can always run this step because the action will exit silently if there are no changes. + # See: https://github.com/marketplace/actions/create-pull-request#action-behaviour + - name: Create PR + uses: peter-evans/create-pull-request@v7 + with: + # By always using the same branch name, we can keep pushing to + # the same branch if there are new changes. + branch: "automatic-dependencies-update" + commit-message: "Update dependencies" + title: "Update dependencies" + body-path: /tmp/pr-body.md + labels: "dependencies,task" + team-reviewers: "dnsimple/platform" + delete-branch: true \ No newline at end of file