Skip to content

Commit

Permalink
Refs #20694: Use eProsima-CI to choose Fast DDS Docs action
Browse files Browse the repository at this point in the history
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz committed Mar 27, 2024
1 parent d6b836d commit a341ce3
Showing 1 changed file with 7 additions and 54 deletions.
61 changes: 7 additions & 54 deletions .github/workflows/documentation-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
description: 'Documentation branch name'
required: true
type: string
default: 'master'

pull_request:
types:
Expand All @@ -20,9 +19,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
ACTION_BRANCH_NAME: ${{ github.ref }}

jobs:
ubuntu-build-and-test-documentation:
name: Documentation build and test
Expand Down Expand Up @@ -85,62 +81,19 @@ jobs:
destination_workspace: src
skip_existing: 'true'

- name: Determine the Fast DDS Documentation branch to be used
run: |
if [[ ${{ github.event_name }} == "push" ]]
then
echo "ACTION_BRANCH_NAME=${{ github.ref }}" >> $GITHUB_ENV
echo "Push event: using pushed branch '${{ github.ref }}' for docs repository"
elif [[ ${{ github.event_name }} == "workflow_dispatch" ]]
then
echo "ACTION_BRANCH_NAME=${{ inputs.documentation_branch }}" >> $GITHUB_ENV
echo "Workflow dispatch event: using input branch '${{ inputs.documentation_branch }}' for docs repository"
elif [[ ${{ github.event_name }} == "pull_request" ]]
then
DOCS_REPO=https://github.com/eProsima/fast-dds-docs.git
# Attempt to use PR's source branch
TEMP_BRANCH=${{ github.head_ref }}
RESPONSE_CODE=$(git ls-remote --heads $DOCS_REPO $TEMP_BRANCH | wc -l)
if [[ ${RESPONSE_CODE} == "0" ]]
then
echo "PR source branch '$TEMP_BRANCH' branch DOES NOT exist in $DOCS_REPO"
# Attempt to use PR's base branch
TEMP_BRANCH=${{ github.base_ref }}
RESPONSE_CODE=$(git ls-remote --heads $DOCS_REPO $TEMP_BRANCH | wc -l)
if [[ ${RESPONSE_CODE} == "0" ]]
then
echo "PR base branch '$TEMP_BRANCH' branch DOES NOT exist in $DOCS_REPO"
# Attempt to use version's branch, which will most likely be the base anyways.
# This is just in case the PR was to an intermediate branch
TEMP_BRANCH=master
RESPONSE_CODE=$(git ls-remote --heads $DOCS_REPO $TEMP_BRANCH | wc -l)
if [[ ${RESPONSE_CODE} == "0" ]]
then
# There are no more fallbacks, so we need to fail here
echo "Version branch '$TEMP_BRANCH' branch DOES NOT exist in $DOCS_REPO"
exit 1
fi
fi
fi
echo "ACTION_BRANCH_NAME=$TEMP_BRANCH" >> $GITHUB_ENV
echo "PR event: using deduced branch '$TEMP_BRANCH' for docs repository"
fi
- name: Get Fast DDS Docs branch
id: get_fastdds_docs_branch
uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@feature/get_related_branch_from_repo
with:
remote_repository: eProsima/Fast-DDS-docs
fallback_branch: ${{ inputs.documentation_branch || github.ref }}

- name: Download FastDDS documentation repo
uses: eProsima/eProsima-CI/external/checkout@v0
with:
repository: eProsima/Fast-DDS-docs
path: src/fastdds-docs
ref: ${{ env.ACTION_BRANCH_NAME }}
ref: ${{ steps.deduce_branch.outputs.deduced_branch }}

- name: Install Fast DDS Docs required python packages
uses: eProsima/eProsima-CI/ubuntu/install_python_packages@v0
Expand Down

0 comments on commit a341ce3

Please sign in to comment.