From 231178dec39277a92e1cf03a2d2b2a6c853b1ef3 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Tue, 12 Nov 2024 18:22:26 +0100 Subject: [PATCH] Check dependency updates automatically in CI (#43) --- .github/workflows/check-deps.sh | 53 ++++++++++++++++++++++++++++++++ .github/workflows/check_deps.yml | 43 ++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100755 .github/workflows/check-deps.sh create mode 100644 .github/workflows/check_deps.yml diff --git a/.github/workflows/check-deps.sh b/.github/workflows/check-deps.sh new file mode 100755 index 0000000..7ac2236 --- /dev/null +++ b/.github/workflows/check-deps.sh @@ -0,0 +1,53 @@ +#!/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" +fi + +git checkout -b "$BRANCH_NAME" +git add . + +git commit -F- <