Checkout remote repository first

My workflow includes cloning Fast-DDS repo v1.8.x branch and building it wusing CMake and installing on build machine.
Running the action results in git error:

Set up job4s
Download action repository 'actions/upload-release-asset@v1'
Current runner version: '2.273.1'
Operating System
  Ubuntu
  18.04.5
  LTS
Virtual Environment
  Environment: ubuntu-18.04
  Version: 20200908.1
  Included Software: https://github.com/actions/virtual-environments/blob/ubuntu18/20200908.1/images/linux/Ubuntu1804-README.md
Prepare workflow directory
Prepare all required actions
Download action repository 'actions/checkout@v2'
Download action repository 'actions/create-release@latest'
Download action repository 'actions/upload-release-asset@v1'

Run actions/checkout@v2
  with:
    repository: eProsima/Fast-DDS.git
    ref: 1.18.x
    path: Fast-DDS
    token: ***
    ssh-strict: true
    persist-credentials: true
    clean: true
    fetch-depth: 1
    lfs: false
    submodules: false
  env:
    BUILD_TYPE: Release
Syncing repository: eProsima/Fast-DDS.git
Getting Git version info
  Working directory is '/home/runner/work/ActuialRepoName/ActuialRepoName/Fast-DDS'
  /usr/bin/git version
  git version 2.28.0
Initializing the repository
  /usr/bin/git init /home/runner/work/ActuialRepoName/ActuialRepoName/Fast-DDS
  Initialized empty Git repository in /home/runner/work/ActuialRepoName/ActuialRepoName/Fast-DDS/.git/
  /usr/bin/git remote add origin https://github.com/eProsima/Fast-DDS.git
Disabling automatic garbage collection
  /usr/bin/git config --local gc.auto 0
Setting up auth
  /usr/bin/git config --local --name-only --get-regexp core\.sshCommand
  /usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
  /usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
  /usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
  /usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
Fetching the repository
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/1.18.x*:refs/remotes/origin/1.18.x* +refs/tags/1.18.x*:refs/tags/1.18.x*
  The process '/usr/bin/git' failed with exit code 1
  Waiting 17 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/1.18.x*:refs/remotes/origin/1.18.x* +refs/tags/1.18.x*:refs/tags/1.18.x*
  The process '/usr/bin/git' failed with exit code 1
  Waiting 11 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/1.18.x*:refs/remotes/origin/1.18.x* +refs/tags/1.18.x*:refs/tags/1.18.x*
  ##[error]The process '/usr/bin/git' failed with exit code 1

Below is first part of action YAML.

name: CMake

on: [push]

env:
  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  BUILD_TYPE: Release

jobs:
  build:
    # The CMake configure and build commands are platform agnostic and should work equally
    # well on Windows or Mac.  You can convert this to a matrix build if you need
    # cross-platform coverage.
    # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
      with:
        repository: 'eProsima/Fast-DDS.git'
        ref: '1.18.x'
        path: 'Fast-DDS'
      
    - name: Install Fast-DDS dependencies
      run: apt-get -y install gradle default-jdk
      
    - name: Fast-DDS Create Build Environment
      # Some projects don't allow in-source building, so create a separate build directory
      # We'll use this as our working directory for all subsequent commands
      run: cmake -E make_directory ${{runner.workspace}}/build-Fast-RDDSTPS
      
    - name: Fast-DDS Configure CMake
      # Use a bash shell so we can use the same syntax for environment variable
      # access regardless of the host operating system
      shell: bash
      working-directory: ${{runner.workspace}}/Fast-DDS-build
      # Note the current convention is to use the -S and -B options here to specify source 
      # and build directories, but this is only available with CMake 3.13 and higher.  
      # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
      run: cmake '${{runner.workspace}}/Fast-RTPS' -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DTHIRDPARTY=ON -DBUILD_JAVA=ON
      
    - name: Fast-DDS Build and Install
      working-directory: ${{runner.workspace}}/Fast-DDS-build
      shell: bash
      # Execute the build.  You can specify a specific target with "--target <NAME>"
      run: cmake --build . --config $BUILD_TYPE --target install
      
    - uses: actions/checkout@v2
      with:
        path: 'ActualRepoName'

    ...

Hi @aleksas-pixevia,

Glad to see you in Github Community Forum!

The error is due to the typo for ref value (1.18.x) of actions/checkout, should be ‘1.8.x’.

    - uses: actions/checkout@v2
      with:
        repository: 'eProsima/Fast-DDS.git'
        ref: '1.8.x'
        path: 'Fast-DDS'

Thanks

1 Like