From 2c79879b90079fd362db602a5a2c7f6f39ecf0aa Mon Sep 17 00:00:00 2001 From: Viktor Tachev Date: Mon, 24 Nov 2025 12:19:10 +0200 Subject: [PATCH] chore: update action --- .github/workflows/check-repos-updates.sh | 74 +++++++++++++++++++++++ .github/workflows/check-repos-updates.yml | 18 ++++++ 2 files changed, 92 insertions(+) create mode 100644 .github/workflows/check-repos-updates.sh create mode 100644 .github/workflows/check-repos-updates.yml diff --git a/.github/workflows/check-repos-updates.sh b/.github/workflows/check-repos-updates.sh new file mode 100644 index 0000000..73ba412 --- /dev/null +++ b/.github/workflows/check-repos-updates.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +echo "Stage1 Find Updates" +LATEST_RELEASE=$(curl -s https://api.github.com/repos/telerik/kendo-ui-core/releases | grep tag_name | head -n 1 | cut -d '"' -f 4) +LATEST_THEMES_RELEASE=$(curl -s https://api.github.com/repos/telerik/kendo-themes/releases | jq -r '[.[] | select(.prerelease == false)][0].name' | tr -d v) +echo "Last release version is $LATEST_RELEASE" +echo "Last Themes release version is $LATEST_THEMES_RELEASE" + +function getCurrentVersion { + for file in `find . -type f -name "*.cshtml"` + do + CURRENT_VERSION=$(grep -hnr "kendo.cdn" $file | head -2 | tail -1 | cut -d '/' -f 4) + if [ ! -z "$CURRENT_VERSION" ] + then + CURRENT_GLOBAL_VERSION=$CURRENT_VERSION + fi + done +} + +function getCurrentThemesVersion { + for file in `find . -type f -name "*.cshtml"` + do + CURRENT_THEMES_VERSION=$(grep -hnr "kendo.cdn" $file | head -1 | cut -d '/' -f 5) + if [ ! -z "$CURRENT_THEMES_VERSION" ] + then + CURRENT_GLOBAL_THEMES_VERSION=$CURRENT_THEMES_VERSION + fi + done +} + getCurrentVersion $file + getCurrentThemesVersion $file + + echo "Current version is $CURRENT_GLOBAL_VERSION" + echo "Current themes version is $CURRENT_GLOBAL_THEMES_VERSION" + + +for file in `find . -type f -name "*.cshtml"` +do + sed -i "s/$CURRENT_GLOBAL_VERSION/$LATEST_RELEASE/g" $file + sed -i "s/$CURRENT_GLOBAL_THEMES_VERSION/$LATEST_THEMES_RELEASE/g" $file +done +for file in `find . -type f -name "*.csproj"` +do + sed -i "s/$CURRENT_GLOBAL_VERSION/$LATEST_RELEASE/g" $file +done +for file in `find . -type f -name "*.config"` +do + sed -i "s/$CURRENT_GLOBAL_VERSION/$LATEST_RELEASE/g" $file +done + +echo "Stage2 Commit the change" +reviewers="Dimitar-Goshev" +echo $reviewers +BRANCH_NAME="update-dependencies" +PRs=$(gh pr list | grep "$BRANCH_NAME" || true) +echo "PRs are:" +echo $PRs +echo "Branch is:" +echo $BRANCH_NAME +if [ ! -z $PRs ]; then + echo "Unmerged pr $BRANCH_NAME" +else + git fetch origin + git pull + git checkout -b $BRANCH_NAME + git config user.email "kendo-bot@progress.com" + git config user.name "kendo-bot" + git add . && git commit -m "chore: update dependencies" + git pull + git push -u origin $BRANCH_NAME + gh pr create --base master --head $BRANCH_NAME --reviewer $reviewers \ + --title "Update dependencies $DATE" --body 'Please review and update dependencies' + + git diff +fi diff --git a/.github/workflows/check-repos-updates.yml b/.github/workflows/check-repos-updates.yml new file mode 100644 index 0000000..85fef57 --- /dev/null +++ b/.github/workflows/check-repos-updates.yml @@ -0,0 +1,18 @@ +name: Check for updates across repos and create pull request + +on: workflow_dispatch +jobs: + check-repos-updates: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v2 + with: + repository: ${{ github.repository }} + + - name: Clean up + run: rm -rf kendo-* + - name: Get repos deps + run: .github/workflows/check-repos-updates.sh ${{ secrets.GH_TOKEN }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file