Skip to content

Commit

Permalink
Fix git_diff action
Browse files Browse the repository at this point in the history
Signed-off-by: jparisu <[email protected]>
  • Loading branch information
jparisu committed May 11, 2023
1 parent 5a1c3f7 commit db15f22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 73 deletions.
72 changes: 2 additions & 70 deletions ubuntu/check_version_update/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,85 +32,17 @@ runs:
with:
workspace: ${{ github.workspace }}

- name: Test outputs
shell: bash
id: test1
run: |
echo "::group::Test"
echo "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
echo "test1-output=false" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
echo "::endgroup::"
- name: Test outputs reception
shell: bash
run: |
echo "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
echo "${{ steps.test1.outputs.test1-output }}"
- name: Get diff file of version file
id: diff2
id: git-diff
uses: eProsima/eProsima-CI/ubuntu/git_diff@feature/versions-update
with:
file-path: ${{ github.workspace }}/${{ inputs.version-file-path }}

- name: get_git_diff_files
id: diff1
shell: bash
run: |
echo "::group::Get git modifications of file ${{ inputs.file-path }}"
echo "have-changes=false" >> $GITHUB_OUTPUT
echo "diff-file-result=" >> $GITHUB_OUTPUT
echo "::endgroup::"
- name: Check if file change
shell: bash
run: |
if [[ "${{ steps.git_diff.outputs.have-changes }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
else
echo "Version file ${{ inputs.version-file-path }} updated."
echo "HURRAY! ^.^"
fi
if [[ "${{ steps.diff3.outputs.have-changes }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
else
echo "Version file ${{ inputs.version-file-path }} updated."
echo "HURRAY! ^.^"
fi
if [[ "${{ steps.diff2.outputs.have-changes }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
else
echo "Version file ${{ inputs.version-file-path }} updated."
echo "HURRAY! ^.^"
fi
if [[ "${{ steps.diff2.outputs.have-change }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
else
echo "Version file ${{ inputs.version-file-path }} updated."
echo "HURRAY! ^.^"
fi
if [[ "${{ steps.diff1.outputs.have-changes }}" != "true" ]]; then
if [[ "${{ steps.git-diff.outputs.have-changes }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
exit 1
Expand Down
6 changes: 3 additions & 3 deletions ubuntu/git_diff/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ outputs:

diff-file-result:
description: The path to the file containing the diff, if changes were detected
value: ${{ steps.run.outputs.diff-file-result }}

have-changes:
description: Whether there have been changes in such file
value: ${{ steps.run.outputs.have-changes }}

runs:
using: composite
steps:

- name: get_git_diff_files
id: diff3
id: run
shell: bash
run: |
Expand All @@ -54,13 +56,11 @@ runs:
if [ -s "${{ inputs.result-file }}" ]; then
echo "have-changes=true" >> $GITHUB_OUTPUT
echo "have-change=true" >> $GITHUB_OUTPUT
echo "File has changes"
else
echo "have-changes=false" >> $GITHUB_OUTPUT
echo "have-change=false" >> $GITHUB_OUTPUT
echo "File has not changes"
fi
Expand Down

0 comments on commit db15f22

Please sign in to comment.