From 58232f2ea1b50624722a2e6434a2c884eb3bfb8b Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Tue, 5 Dec 2023 11:57:56 -0800 Subject: [PATCH] Move checkout workspace to action --- .github/actions/checkout/action.yml | 9 ++++++++ .github/workflows/test_definitions.yml | 31 +------------------------- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/.github/actions/checkout/action.yml b/.github/actions/checkout/action.yml index ad0e28fe2..42a8c568b 100644 --- a/.github/actions/checkout/action.yml +++ b/.github/actions/checkout/action.yml @@ -2,6 +2,9 @@ name: 'Checkout Repositories' description: 'Checkout the repositories depending on the inputs' inputs: + ref: + description: 'The sailbot workspace ref to checkout' + required: true repository: description: 'The repository name: github.event.repository.name' required: true @@ -9,6 +12,12 @@ inputs: runs: using: "composite" steps: + - name: Checkout workspace + uses: actions/checkout@v4 + with: + repository: UBCSailbot/sailbot_workspace + ref: ${{ needs.extract-metadata.outputs.caller-ref }} + - name: Checkout ROS package if: ${{ inputs.repository != 'sailbot_workspace' }} uses: actions/checkout@v4 diff --git a/.github/workflows/test_definitions.yml b/.github/workflows/test_definitions.yml index 21efad853..f289f9c2d 100644 --- a/.github/workflows/test_definitions.yml +++ b/.github/workflows/test_definitions.yml @@ -65,15 +65,10 @@ jobs: if: ${{ inputs.ros-ci }} needs: [extract-metadata] steps: - - name: Checkout workspace - uses: actions/checkout@v4 - with: - repository: UBCSailbot/sailbot_workspace - ref: ${{ needs.extract-metadata.outputs.caller-ref }} - - name: Checkout repositories uses: ./.github/actions/checkout/ with: + ref: ${{ needs.extract-metadata.outputs.caller-ref }} repository: ${{ inputs.repository }} - name: Test @@ -93,12 +88,6 @@ jobs: if: ${{ inputs.ros-ci }} needs: [extract-metadata] steps: - - name: Checkout workspace - uses: actions/checkout@v4 - with: - repository: UBCSailbot/sailbot_workspace - ref: ${{ needs.extract-metadata.outputs.caller-ref }} - - name: Checkout repositories uses: ./.github/actions/checkout/ with: @@ -116,12 +105,6 @@ jobs: if: inputs.clang-tidy needs: [extract-metadata] steps: - - name: Checkout workspace - uses: actions/checkout@v4 - with: - repository: UBCSailbot/sailbot_workspace - ref: ${{ needs.extract-metadata.outputs.caller-ref }} - - name: Checkout repositories uses: ./.github/actions/checkout/ with: @@ -139,12 +122,6 @@ jobs: if: ${{ inputs.markdown-ci }} needs: [extract-metadata] steps: - - name: Checkout workspace - uses: actions/checkout@v4 - with: - repository: UBCSailbot/sailbot_workspace - ref: ${{ needs.extract-metadata.outputs.caller-ref }} - - name: Checkout repositories uses: ./.github/actions/checkout/ with: @@ -173,12 +150,6 @@ jobs: if: ${{ inputs.markdown-ci }} needs: [extract-metadata] steps: - - name: Checkout workspace - uses: actions/checkout@v4 - with: - repository: UBCSailbot/sailbot_workspace - ref: ${{ needs.extract-metadata.outputs.caller-ref }} - - name: Checkout repositories uses: ./.github/actions/checkout/ with: