Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: pr_test
description: Check Pull Request

on:
workflow_dispatch:
pull_request:

jobs:

dummy:
version-update:
runs-on: ubuntu-22.04
steps:
- name: Do nothing yet
shell: bash
run: |
echo "ToDo"

- name: Check wether the versions.md file have been updated
uses: eProsima/eProsima-CI/ubuntu/check_version_update@feature/versions-update
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ The main idea is to collect every repeated or generic step of any CI to have a s
- [User manual](#user-manual)
- [Out-of-the-box Actions Implemented](#out-of-the-box-actions-implemented)
- [Actions Implemented](#actions-implemented)
- [Multiplatform](#multiplatform)
- [Ubuntu](#ubuntu)
- [Dependencies built](#dependencies-built)
- [Artifacts uploaded](#artifacts-uploaded)
- [Multiplatform](#multiplatform)
- [Ubuntu](#ubuntu)
- [Workflows](#workflows)
- [Artifacts uploaded](#artifacts-uploaded)
- [Generate artifacts manually](#generate-artifacts-manually)
- [Custom artifact generation](#custom-artifact-generation)
- [External Actions](#external-actions)

---
Expand Down Expand Up @@ -49,6 +50,10 @@ For more information about versioning handle of this project, check following [f
- *Only on ubuntu*.
- *Only for documentation projects based in [cmake_utils](https://github.com/eProsima/dev-utils)*.

- [check_version_update](ubuntu/check_version_update/action.yml)
- Check that the document containing version changes have changed.
- *Only on ubuntu*.

---

## Actions Implemented
Expand Down Expand Up @@ -124,6 +129,10 @@ For more information about versioning handle of this project, check following [f
- Get the files that differ from one github reference to another.
The result can be parsed with `grep`.

- [git_diff](ubuntu/git_diff/action.yml)
- Get the diff file of a file contained in a git repository.
It returns true or false whether the file has changes.

- [git_fetch_all](ubuntu/git_fetch_all/action.yml)
- Get all branches of a specific repository.

Expand Down
5 changes: 5 additions & 0 deletions external/create-pull-request/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,24 @@ outputs:

pull-request-number:
description: 'The pull request number'
pull-request-number: ${{ steps.run.outputs.pull-request-number }}
pull-request-url:
description: 'The URL of the pull request.'
pull-request-url: ${{ steps.run.outputs.pull-request-url }}
pull-request-operation:
description: 'The pull request operation performed by the action, `created`, `updated` or `closed`.'
pull-request-operation: ${{ steps.run.outputs.pull-request-operation }}
pull-request-head-sha:
description: 'The commit SHA of the pull request branch.'
pull-request-head-sha: ${{ steps.run.outputs.pull-request-head-sha }}

runs:
using: composite
steps:

- name: Create PR
uses: peter-evans/create-pull-request@v5
id: run
with:
token: ${{ inputs.token }}
path: ${{ inputs.path }}
Expand Down
52 changes: 52 additions & 0 deletions ubuntu/check_version_update/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: check_version_update
description: Check if version file has been updated with the change in the repository

inputs:

version-file-path:
description: The path to the file to check for changes from repository base
required: true
default: versions.md

head-ref:
description: Git reference to compare file
required: false
default: ${GITHUB_HEAD_REF}

base-ref:
description: Git reference to compare against
required: false
default: ${GITHUB_BASE_REF}

runs:
using: composite
steps:

- name: Sync repository
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@feature/versions-update
with:
workspace: ${{ github.workspace }}

- name: Get diff file of version file
id: git-diff
uses: eProsima/eProsima-CI/ubuntu/git_diff@feature/versions-update
with:
file-path: ${{ github.workspace }}/${{ inputs.version-file-path }}

- 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"
exit 1
else
echo "Version file ${{ inputs.version-file-path }} updated."
echo "HURRAY! ^.^"
fi
64 changes: 64 additions & 0 deletions ubuntu/git_diff/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: git_diff
description: Check whether a file in a repository has changed and return diff file

inputs:

file-path:
description: The path to the file to check for changes
required: true

head-ref:
description: Git reference to compare file
required: false
default: origin/${GITHUB_HEAD_REF}

base-ref:
description: Git reference to compare against
required: false
default: origin/${GITHUB_BASE_REF}

diff-args:
description: Additional arguments to pass to the git diff command
required: false
default: ''

result-file:
description: Additional arguments to pass to the git diff command
required: false
default: ${{ github.workspace }}/git.diff

outputs:

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: run
shell: bash
run: |

echo "::group::Get git modifications of file ${{ inputs.file-path }}"

git diff "${{ inputs.base-ref }}" "${{ inputs.head-ref }}" ${{ inputs.diff-args }} -- "${{ inputs.file-path }}" > "${{ inputs.result-file }}"

echo "Diff file result:"
cat "${{ inputs.result-file }}"

if [ -s "${{ inputs.result-file }}" ]; then

echo "have-changes=true" >> $GITHUB_OUTPUT
echo "File has changes"

else

echo "have-changes=false" >> $GITHUB_OUTPUT
echo "File has not changes"

fi

echo "::endgroup::"
10 changes: 10 additions & 0 deletions versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ The *Forthcoming* section includes those features added in `main` branch that ar
- [v0.3.0](#v0.3.0)
- [v0.2.0](#v0.2.0)

## Forthcoming

This release includes the following **CI features**:

- Add a check for every PR that checks if `versions.md` file have been updated with new PRs.

This release includes the following **features**:

- `check_version_update` action to check if version documentation file have been updated.

## v0.3.0

This release includes the following **bug-fixes**:
Expand Down