Skip to content

Commit 925889f

Browse files
author
jparisu
committed
fix workflow
Signed-off-by: jparisu <javierparis@eprosima.com>
1 parent 22a1e54 commit 925889f

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

.github/workflows/pr_test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: pr_test
2-
description: Check Pull Request
32

43
on:
54
workflow_dispatch:
@@ -11,4 +10,4 @@ jobs:
1110
runs-on: ubuntu-22.04
1211
steps:
1312
- name: Check wether the versions.md file have been updated
14-
uses: eProsima/eProsima-CI/ubuntu/check_version_update@main
13+
uses: eProsima/eProsima-CI/ubuntu/check_version_update@feature/versions-update

ubuntu/check_version_update/action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,24 @@ runs:
2323
steps:
2424

2525
- name: Sync repository
26-
uses: eProsima/eProsima-CI/external/checkout@main
26+
uses: eProsima/eProsima-CI/external/checkout@feature/versions-update
2727
with:
2828
path: ${{ github.workspace }}
2929

3030
- name: Fetch all branches and tags
31-
uses: eProsima/eProsima-CI/ubuntu/git_fetch_all@main
31+
uses: eProsima/eProsima-CI/ubuntu/git_fetch_all@feature/versions-update
3232
with:
3333
workspace: ${{ github.workspace }}
3434

3535
- name: Get diff file of version file
3636
id: git-diff
37-
uses: eProsima/eProsima-CI/ubuntu/git_diff@main
37+
uses: eProsima/eProsima-CI/ubuntu/git_diff@feature/versions-update
3838
with:
3939
file-path: ${{ github.workspace }}/${{ inputs.version-file-path }}
4040

4141
- name: Check if file change
4242
if: ${{ steps.git-diff.outputs.have-changes == 'false' }}
43+
shell: bash
4344
run: |
4445
echo "Version file ${{ inputs.version-file-path }} has not been updated."
4546
exit 1

ubuntu/git_diff/action.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ inputs:
1010
head-ref:
1111
description: Git reference to compare file
1212
required: false
13-
default: ${GITHUB_HEAD_REF}
13+
default: origin/${GITHUB_HEAD_REF}
1414

1515
base-ref:
1616
description: Git reference to compare against
1717
required: false
18-
default: ${GITHUB_BASE_REF}
18+
default: origin/${GITHUB_BASE_REF}
1919

2020
diff-args:
2121
description: Additional arguments to pass to the git diff command
@@ -43,13 +43,12 @@ runs:
4343
shell: bash
4444
run: |
4545
46-
echo "::group::Get git modifications of file ${{ inputs.file-path }}""
46+
echo "::group::Get git modifications of file ${{ inputs.file-path }}"
4747
48-
if git diff --name-only "${{ inputs.base-ref }}" "${{ inputs.head-ref }}" ${{ inputs.diff-args }} | grep -q "${{ inputs.file-path }}"; then
48+
git diff "${{ inputs.base-ref }}" "${{ inputs.head-ref }}" ${{ inputs.diff-args }} -- "${{ inputs.file-path }}" > "${{ inputs.result-file }}"
4949
50-
git diff "${{ inputs.base-ref }}" "${{ inputs.head-ref }}" ${{ inputs.diff-args }} "${{ inputs.file-path }}" > "${{ inputs.result-file }}"
50+
if [ -s "${{ inputs.result-file }}" ]; then
5151
52-
echo "::set-output name=diff-file-result::$(cat ${{ inputs.result-file }})"
5352
echo "::set-output name=have-changes::true"
5453
5554
else
@@ -58,4 +57,6 @@ runs:
5857
5958
fi
6059
60+
echo "::set-output name=diff-file-result::$(cat "${{ inputs.result-file }}")"
61+
6162
echo "::endgroup::"

0 commit comments

Comments
 (0)