diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index e125778..c15f87a 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -12,3 +12,8 @@ jobs: uses: ./.github/workflows/linter.yml secrets: github-token: ${{ secrets.github-token }} + + test-matrix-outputs: + name: Test get & set matrix outputs actions + needs: linter + uses: ./.github/workflows/__test-matrix-outputs.yml diff --git a/.github/workflows/__test-matrix-outputs.yml b/.github/workflows/__test-matrix-outputs.yml new file mode 100644 index 0000000..7c5f0fc --- /dev/null +++ b/.github/workflows/__test-matrix-outputs.yml @@ -0,0 +1,32 @@ +name: Internal - Test for get matrix outputs + +on: + workflow_call: + +jobs: + set-and-get-matrix-outputs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: ./actions/set-matrix-output + with: + value: '"test content 1"' + artifact-name: "test-matrix-outputs" + + - uses: ./actions/set-matrix-output + with: + value: '"test content 2"' + artifact-name: "test-matrix-outputs" + + - id: get-matrix-outputs + uses: ./actions/get-matrix-outputs + with: + artifact-name: test-matrix-outputs + + - name: Check matrix outputs + run: | + if [ "${{ steps.get-matrix-outputs.outputs.result }}" != '["test content 1","test content 2"]' ]; then + echo "Get matrix outputs result is not valid" + exit 1 + fi diff --git a/actions/get-matrix-outputs/action.yml b/actions/get-matrix-outputs/action.yml index 77b0343..6af9e63 100644 --- a/actions/get-matrix-outputs/action.yml +++ b/actions/get-matrix-outputs/action.yml @@ -15,14 +15,14 @@ inputs: outputs: result: description: "The matrix combined JSON outputs." - value: ${{ steps.get-matrix-outputs.outputs.result }} + value: ${{ steps.read-artifacts.outputs.result }} runs: using: "composite" steps: - uses: actions/download-artifact@v3 with: - name: ${{ inputs.artifact-name }}} + name: ${{ inputs.artifact-name }} path: /tmp/${{ inputs.artifact-name }} - id: read-artifacts diff --git a/actions/set-matrix-output/action.yml b/actions/set-matrix-output/action.yml index 2bc1e4b..2b511ab 100644 --- a/actions/set-matrix-output/action.yml +++ b/actions/set-matrix-output/action.yml @@ -15,10 +15,6 @@ inputs: artifact-name: description: "The name of the artifact to upload." required: true -outputs: - result: - description: "The matrix combined JSON outputs." - value: ${{ steps.get-issue-number.outputs.result }} runs: using: "composite" @@ -41,7 +37,7 @@ runs: exit 1 fi - echo '${{ inputs.matrix-output }}' > "$MATRIX_OUTPUT_FILE" + echo '${{ inputs.value }}' > "$MATRIX_OUTPUT_FILE" - uses: actions/upload-artifact@v3 with: