Skip to content

Commit

Permalink
Fix sailbot workspace ref in CI (#191)
Browse files Browse the repository at this point in the history
* Try fetching ref automatically

* Fill in owner and repo

* Actually use
  • Loading branch information
patrick-5546 committed Nov 4, 2023
1 parent dfa1e3c commit a0b69c0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/test_definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,30 @@ on:
required: false

jobs:
metadata:
name: Extract metadata
runs-on: ubuntu-latest
permissions:
actions: read
outputs:
caller-sha: ${{ steps.workflows-ref.outputs.caller-sha }}
steps:
- name: Get workflow reference
id: workflows-ref
run: |
sha=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.gh-token }}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/UBCSailbot/sailbot_workspace/actions/runs/${{ github.run_id }} | jq -r '.referenced_workflows[0] | .sha')
echo "caller-sha=$sha" >> $GITHUB_OUTPUT
colcon-test:
runs-on: ubuntu-latest
if: ${{ inputs.ros-ci }}
needs: [metadata]
steps:
- name: Checkout workspace
uses: actions/checkout@v4
with:
repository: UBCSailbot/sailbot_workspace
ref: ${{ needs.metadata.outputs.caller-sha }}

- name: Checkout repositories
uses: ./.github/actions/checkout/
Expand All @@ -66,11 +82,13 @@ jobs:
name: ament_${{ matrix.linter }}
runs-on: ubuntu-latest
if: ${{ inputs.ros-ci }}
needs: [metadata]
steps:
- name: Checkout workspace
uses: actions/checkout@v4
with:
repository: UBCSailbot/sailbot_workspace
ref: ${{ needs.metadata.outputs.caller-sha }}

- name: Checkout repositories
uses: ./.github/actions/checkout/
Expand All @@ -86,11 +104,13 @@ jobs:
clang-tidy:
runs-on: ubuntu-latest
if: inputs.clang-tidy
needs: [metadata]
steps:
- name: Checkout workspace
uses: actions/checkout@v4
with:
repository: UBCSailbot/sailbot_workspace
ref: ${{ needs.metadata.outputs.caller-sha }}

- name: Checkout repositories
uses: ./.github/actions/checkout/
Expand Down

0 comments on commit a0b69c0

Please sign in to comment.