From b0ba31bb8f478160f42c790972cffff8718c46bd Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Tue, 7 Jan 2025 21:33:50 +0100 Subject: [PATCH 1/5] Fix automatic dependency update --- .github/workflows/check-deps.sh | 54 -------------------------------- .github/workflows/check_deps.yml | 27 ++++++++++++++-- 2 files changed, 24 insertions(+), 57 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- < pr-body.md + TERM=dumb rebar3 update-deps --replace >> pr-body.md + echo "```" >> pr-body.md + rebar3 fmt --write env: BRANCH_NAME: update-deps-${{ github.run_id }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # 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: pr-body.md + labels: "dependencies" + assignees: "weppos" + reviewers: "weppos" + delete-branch: true From 8ea938a3aa6f682c6da3e09c60cd44c9519cab59 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Tue, 7 Jan 2025 21:38:13 +0100 Subject: [PATCH 2/5] FIXUP --- .github/workflows/check_deps.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_deps.yml b/.github/workflows/check_deps.yml index 0e79bd34..ffb012e7 100644 --- a/.github/workflows/check_deps.yml +++ b/.github/workflows/check_deps.yml @@ -41,9 +41,9 @@ jobs: - name: Update dependencies id: update-deps run: | - echo "Output of running \`rebar3 update-deps\`:\n\n```" > pr-body.md + echo "Output of running \`rebar3 update-deps\`:\n\n\`\`\`" > pr-body.md TERM=dumb rebar3 update-deps --replace >> pr-body.md - echo "```" >> pr-body.md + echo "\`\`\`" >> pr-body.md rebar3 fmt --write env: BRANCH_NAME: update-deps-${{ github.run_id }} From 81f73f21997674f46ad9dab7b3c327c325cc2624 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Tue, 7 Jan 2025 21:46:15 +0100 Subject: [PATCH 3/5] FIXUP --- .github/workflows/check_deps.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check_deps.yml b/.github/workflows/check_deps.yml index ffb012e7..b665b8ce 100644 --- a/.github/workflows/check_deps.yml +++ b/.github/workflows/check_deps.yml @@ -41,13 +41,17 @@ jobs: - name: Update dependencies id: update-deps run: | - echo "Output of running \`rebar3 update-deps\`:\n\n\`\`\`" > pr-body.md - TERM=dumb rebar3 update-deps --replace >> pr-body.md - echo "\`\`\`" >> pr-body.md + _update_output="$(TERM=dumb rebar3 update-deps --replace)" + + cat < /tmp/pr-body.md + Output of running \`rebar3 update-deps\`: + + \``` + $_update_output + \``` + EOF + rebar3 fmt --write - env: - BRANCH_NAME: update-deps-${{ github.run_id }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 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 @@ -59,7 +63,7 @@ jobs: branch: "automatic-dependencies-update" commit-message: "Update dependencies" title: "Update dependencies" - body-path: pr-body.md + body-path: /tmp/pr-body.md labels: "dependencies" assignees: "weppos" reviewers: "weppos" From 7750a4fcdcbdd3a23644180941a54fe6dc25a4c6 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Tue, 14 Jan 2025 08:28:33 +0100 Subject: [PATCH 4/5] Update .github/workflows/check_deps.yml Co-authored-by: Santiago Traversa --- .github/workflows/check_deps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_deps.yml b/.github/workflows/check_deps.yml index b665b8ce..cab056a4 100644 --- a/.github/workflows/check_deps.yml +++ b/.github/workflows/check_deps.yml @@ -64,7 +64,7 @@ jobs: commit-message: "Update dependencies" title: "Update dependencies" body-path: /tmp/pr-body.md - labels: "dependencies" + labels: "dependencies,task" assignees: "weppos" reviewers: "weppos" delete-branch: true From 1442b15215620bd127fc87bb800d3d5ff2012cdd Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Tue, 14 Jan 2025 08:28:42 +0100 Subject: [PATCH 5/5] Update .github/workflows/check_deps.yml Co-authored-by: Santiago Traversa --- .github/workflows/check_deps.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check_deps.yml b/.github/workflows/check_deps.yml index cab056a4..133ebc6d 100644 --- a/.github/workflows/check_deps.yml +++ b/.github/workflows/check_deps.yml @@ -65,6 +65,5 @@ jobs: title: "Update dependencies" body-path: /tmp/pr-body.md labels: "dependencies,task" - assignees: "weppos" - reviewers: "weppos" + team-reviewers: "dnsimple/platform" delete-branch: true