From ddd790bebea10e0d3f7da48987e73d57672f1327 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Tue, 14 Jan 2025 08:34:08 +0100 Subject: [PATCH] Fix automatic dependency update (#176) Co-authored-by: Santiago Traversa --- .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 f7c60212..00000000 --- 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, also reformatting" - 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