Search code examples
githubgithub-actions

how to send to the output a script's test


I have a bash script which generates an execution matrix I wanna use within another job.

the scripts executes correctly, but when it comes to redirect the output, the step fails:

Run echo "tst=$(${PWD}/dev/i18n-scripts/generate-matrix.sh)\n" >> $GITHUB_GITHUB_OUTPUT
  
/__w/_temp/ce44932f-d406-437e-b87d-842822d14b51.sh: 1: cannot create : Directory nonexistent
Error: Process completed with exit code 2.

here is the step:

        steps:
            - name: checkout
              uses: actions/checkout@v3
            - name: make-it-executable
              run: chmod +x ${PWD}/dev/i18n-scripts/generate-matrix.sh
            - name: set-matrix
              run: echo "tst=$(${PWD}/dev/i18n-scripts/generate-matrix.sh)\n" >> $GITHUB_GITHUB_OUTPUT

If I remove >> $GITHUB_GITHUB_OUTPUT it executes correctly, without the expected output set, of course. What's wrong with it?


Solution

  • Try using $GITHUB_OUTPUT instead of $GITHUB_GITHUB_OUTPUT:

    Run echo "tst=$(${PWD}/dev/i18n-scripts/generate-matrix.sh)\n" >> $GITHUB_OUTPUT