From 78d27b70aef065dfd8b59ee89b1778f0fc269b83 Mon Sep 17 00:00:00 2001 From: f-peverali <112709306+f-peverali@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:27:58 +0200 Subject: [PATCH] fix if statement --- .github/workflows/TooLUpdateNotification.yml | 49 ++++++++++---------- .github/workflows/ToolUpdate.yml | 6 ++- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.github/workflows/TooLUpdateNotification.yml b/.github/workflows/TooLUpdateNotification.yml index e52b07df..2d1ddb44 100644 --- a/.github/workflows/TooLUpdateNotification.yml +++ b/.github/workflows/TooLUpdateNotification.yml @@ -13,30 +13,29 @@ permissions: jobs: update-dependency: runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up jq - run: sudo apt-get install jq - - - name: Fetch latest version of dependency - id: fetch_version - run: | - # Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository - LATEST_VERSION=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) - echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV - - - name: Check difference with main.yml, throw a warning within console and github action if the version is not up-to-date - run: | - CURRENT_VERSION=$(grep -oP '(?<=uses: FirelyTeam/firely-terminal-pipeline@).*$' .github/workflows/main.yml) - - # If they differ, print the current version in the main.yml file and compare it with the latest version in the repository. - if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then - echo "::warning::Current version of Firely Terminal in main.yml: $CURRENT_VERSION" - echo "::warning::Latest version of Firely Terminal in repository: $LATEST_VERSION" - echo "::warning::The version in main.yml is not up-to-date. Please update it." - else - echo "Current version in main.yml is up-to-date" + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up jq + run: sudo apt-get install jq + + - name: Fetch latest version of dependency + id: fetch_version + run: | + # Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository + LATEST_VERSION=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) + echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV + + - name: Check difference with main.yml, throw a warning within console and github action if the version is not up-to-date + run: | + CURRENT_VERSION=$(grep -oP '(?<=uses: FirelyTeam/firely-terminal-pipeline@).*$' .github/workflows/main.yml) + # If they differ, print the current version in the main.yml file and compare it with the latest version in the repository. + if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then + echo "::warning::Current version of Firely Terminal in main.yml: $CURRENT_VERSION" + echo "::warning::Latest version of Firely Terminal in repository: $LATEST_VERSION" + echo "::warning::The version in main.yml is not up-to-date. Please update it." + else + echo "Current version in main.yml is up-to-date" + fi diff --git a/.github/workflows/ToolUpdate.yml b/.github/workflows/ToolUpdate.yml index 209bb1f9..01fdd7d8 100644 --- a/.github/workflows/ToolUpdate.yml +++ b/.github/workflows/ToolUpdate.yml @@ -1,7 +1,9 @@ name: Update Dependency -on: # Trigger only manually within github page - workflow_dispatch: # Allows manual trigger +on: + push: + branches: + - '**' # Trigger on commits to any branch permissions: contents: write