github-actions

GitHub action to simply cat a file to an output


I want to cat the contents of my VERSION file (e.g. 0.9.0) into a variable and pass it to another GitHub action as input. However, from what I can tell, this requires creating a new GitHub action just to cat the file to an 'output' which could then be used as input to the next module.

Is there a GitHub action that already does this - or is there some simpler solution I'm missing?


Solution

  • I don't think you need to create an action for this. cat should be usable in a run step.

    Try something like this:

          - name: Get version
            id: vars
            run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
          - name: Test output
            run: echo ${{ steps.vars.outputs.version }}