From d0d40a217e6cd79f94d353113cf099c4cd4371a5 Mon Sep 17 00:00:00 2001 From: jparisu Date: Wed, 10 May 2023 16:45:05 +0200 Subject: [PATCH] fix workflow Signed-off-by: jparisu --- .github/workflows/pr_test.yml | 3 +-- ubuntu/check_version_update/action.yml | 7 ++++--- ubuntu/git_diff/action.yml | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml index 31fcb78a..a0bd62a5 100644 --- a/.github/workflows/pr_test.yml +++ b/.github/workflows/pr_test.yml @@ -1,5 +1,4 @@ name: pr_test -description: Check Pull Request on: workflow_dispatch: @@ -11,4 +10,4 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Check wether the versions.md file have been updated - uses: eProsima/eProsima-CI/ubuntu/check_version_update@main + uses: eProsima/eProsima-CI/ubuntu/check_version_update@feature/versions-update diff --git a/ubuntu/check_version_update/action.yml b/ubuntu/check_version_update/action.yml index 9f500e1a..62a2ff48 100644 --- a/ubuntu/check_version_update/action.yml +++ b/ubuntu/check_version_update/action.yml @@ -23,23 +23,24 @@ runs: steps: - name: Sync repository - uses: eProsima/eProsima-CI/external/checkout@main + uses: eProsima/eProsima-CI/external/checkout@feature/versions-update with: path: ${{ github.workspace }} - name: Fetch all branches and tags - uses: eProsima/eProsima-CI/ubuntu/git_fetch_all@main + uses: eProsima/eProsima-CI/ubuntu/git_fetch_all@feature/versions-update with: workspace: ${{ github.workspace }} - name: Get diff file of version file id: git-diff - uses: eProsima/eProsima-CI/ubuntu/git_diff@main + uses: eProsima/eProsima-CI/ubuntu/git_diff@feature/versions-update with: file-path: ${{ github.workspace }}/${{ inputs.version-file-path }} - name: Check if file change if: ${{ steps.git-diff.outputs.have-changes == 'false' }} + shell: bash run: | echo "Version file ${{ inputs.version-file-path }} has not been updated." exit 1 diff --git a/ubuntu/git_diff/action.yml b/ubuntu/git_diff/action.yml index 0944c2dc..a403b0fe 100644 --- a/ubuntu/git_diff/action.yml +++ b/ubuntu/git_diff/action.yml @@ -43,13 +43,12 @@ runs: shell: bash run: | - echo "::group::Get git modifications of file ${{ inputs.file-path }}"" + echo "::group::Get git modifications of file ${{ inputs.file-path }}" - if git diff --name-only "${{ inputs.base-ref }}" "${{ inputs.head-ref }}" ${{ inputs.diff-args }} | grep -q "${{ inputs.file-path }}"; then + git diff "${{ inputs.base-ref }}" "${{ inputs.head-ref }}" ${{ inputs.diff-args }} "${{ inputs.file-path }}" > "${{ inputs.result-file }}" - git diff "${{ inputs.base-ref }}" "${{ inputs.head-ref }}" ${{ inputs.diff-args }} "${{ inputs.file-path }}" > "${{ inputs.result-file }}" + if [ -s "${{ inputs.result-file }}" ]; then - echo "::set-output name=diff-file-result::$(cat ${{ inputs.result-file }})" echo "::set-output name=have-changes::true" else @@ -58,4 +57,6 @@ runs: fi + echo "::set-output name=diff-file-result::$(cat "${{ inputs.result-file }}")" + echo "::endgroup::"