From f9ddc31b77a2c9d06ae1a42ab2c82d8cddf3697a Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 6 Aug 2024 09:04:57 +0200 Subject: [PATCH] ci(bump_deps): attempt to link also commit diff Signed-off-by: Ettore Di Giacinto --- .github/bump_deps.sh | 13 +++++++++++++ .github/workflows/bump_deps.yaml | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/bump_deps.sh b/.github/bump_deps.sh index d8fff4a3..ea730fd9 100755 --- a/.github/bump_deps.sh +++ b/.github/bump_deps.sh @@ -6,4 +6,17 @@ VAR=$3 LAST_COMMIT=$(curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/$REPO/commits/$BRANCH") +# Read $VAR from Makefile (only first match) +set +e +CURRENT_COMMIT="$(grep -m1 "^$VAR?=" Makefile | cut -d'=' -f2)" +set -e + sed -i Makefile -e "s/$VAR?=.*/$VAR?=$LAST_COMMIT/" + +if [ -z "$CURRENT_COMMIT" ]; then + echo "Could not find $VAR in Makefile." + exit 0 +fi + +echo "Updated $VAR from $CURRENT_COMMIT to $LAST_COMMIT." > "$REPO_message.txt" +echo "https://github.com/$REPO/compare/$CURRENT_COMMIT..$LAST_COMMIT" >> "$REPO_message.txt" \ No newline at end of file diff --git a/.github/workflows/bump_deps.yaml b/.github/workflows/bump_deps.yaml index 5909c981..b32dc378 100644 --- a/.github/workflows/bump_deps.yaml +++ b/.github/workflows/bump_deps.yaml @@ -40,8 +40,14 @@ jobs: steps: - uses: actions/checkout@v4 - name: Bump dependencies 🔧 + id: bump run: | bash .github/bump_deps.sh ${{ matrix.repository }} ${{ matrix.branch }} ${{ matrix.variable }} + { + echo 'message<> "$GITHUB_OUTPUT" - name: Create Pull Request uses: peter-evans/create-pull-request@v6 with: @@ -50,7 +56,7 @@ jobs: commit-message: ':arrow_up: Update ${{ matrix.repository }}' title: 'chore: :arrow_up: Update ${{ matrix.repository }}' branch: "update/${{ matrix.variable }}" - body: Bump of ${{ matrix.repository }} version + body: ${{ steps.bump.outputs.message }} signoff: true