I have a public repo as a submodule, and I want to checkout a specific tag in the submodule from a github action.
The problem is that when I use “git checkout {tag}” in the github action, it works if I hardcode the tag myself, but when I use the input variable, I get the error “pathspec ‘{tag}’ did not match any file(s) known to git”.
The following should work fine
name: DFIR IRIS DOCKER Build
on:
workflow_dispatch:
inputs:
IRIS_VERSION:
required: true
description: DFIR IRIS version
default: v2.4.7
type: string
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Git Sumbodule Update
run: |
git submodule update --remote --recursive
git checkout v2.4.7
The following uses an input variable, but throws an error.
name: DFIR IRIS DOCKER Build
on:
workflow_dispatch:
inputs:
IRIS_VERSION:
required: true
description: DFIR IRIS version
default: v2.4.7
type: string
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Git Sumbodule Update
run: |
git submodule update --remote --recursive
git checkout ${{ inputs.IRIS_VERSION }}
github action
Run git submodule update --remote --recursive
git submodule update --remote --recursive
git checkout v2.4.7
shell: /usr/bin/bash -e {0}
error: pathspec 'v2.4.7' did not match any file(s) known to git
The final command we ran was “git checkout v2.4.7”, which is all the same, but with the following syntax: git checkout ${{ inputs.IRIS_VERSION }} does not work.
I would like to know how to solve this.