Skip to content

Commit

Permalink
chore(deps): bump the github-actions-dependencies group
Browse files Browse the repository at this point in the history
Bumps the github-actions-dependencies group in /actions/set-matrix-output with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).

- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
  • Loading branch information
dependabot[bot] authored and neilime committed Feb 9, 2024
1 parent 954bcb8 commit fecdab8
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 57 deletions.
81 changes: 55 additions & 26 deletions .github/workflows/__test-action-matrix-outputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
workflow_call:

jobs:
tests:
name: Tests for set/get matrix outputs
tests-1:
name: Arrange - Set first output
strategy:
matrix:
os:
Expand All @@ -15,45 +15,67 @@ jobs:
steps:
- uses: actions/checkout@v4

- id: set-matrix-output-1
- id: set-matrix-output
uses: ./actions/set-matrix-output
with:
value: |
{ "test": "test content 1" }
artifact-name: "test-matrix-outputs-${{ matrix.os }}"

- id: set-matrix-output-2
uses: ./actions/set-matrix-output
with:
value: ""
artifact-name: "test-matrix-outputs-${{ matrix.os }}"

- id: set-matrix-output-3
uses: ./actions/set-matrix-output
with:
value: |
{ "test": "test content 2" }
artifact-name: "test-matrix-outputs-${{ matrix.os }}"

- name: Check set matrix outputs
shell: bash
run: |
EXPECTED_ARTIFACT_NAME="$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-test-matrix-outputs-${{ matrix.os }}"
if [ "${{ steps.set-matrix-output-1.outputs.artifact-name }}" != "$EXPECTED_ARTIFACT_NAME" ]; then
if [ "${{ steps.set-matrix-output.outputs.artifact-name }}" != "$EXPECTED_ARTIFACT_NAME" ]; then
echo "Set matrix output 1 result is not valid"
exit 1
fi
if [ "${{ steps.set-matrix-output-2.outputs.artifact-name }}" != "$EXPECTED_ARTIFACT_NAME" ]; then
echo "Set matrix output 2 result is not valid"
exit 1
fi
tests-2:
name: Arrange - Set empty output
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

if [ "${{ steps.set-matrix-output-3.outputs.artifact-name }}" != "$EXPECTED_ARTIFACT_NAME" ]; then
echo "Set matrix output 3 result is not valid"
exit 1
fi
- uses: ./actions/set-matrix-output
with:
value: ""
artifact-name: "test-matrix-outputs-${{ matrix.os }}"

tests-3:
name: Arrange - Set third output
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: ./actions/set-matrix-output
with:
value: |
{ "test": "test content 3" }
artifact-name: "test-matrix-outputs-${{ matrix.os }}"

assert:
needs: [tests-1, tests-2, tests-3]
name: Assert - Check outputs
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- id: get-matrix-outputs
uses: ./actions/get-matrix-outputs
Expand All @@ -65,7 +87,14 @@ jobs:
run: |
OUTPUT_RESULT='${{ steps.get-matrix-outputs.outputs.result }}'
if [ "$OUTPUT_RESULT" != '[{ "test": "test content 1" },{ "test": "test content 2" }]' ]; then
# Output result must be a json array of 2 entries
if [ "$(echo "$OUTPUT_RESULT" | jq -e '. | length')" != "2" ]; then
echo "Get matrix outputs result is not valid"
exit 1
fi
# Output result must contain the first and third entries
if [ "$(echo "$OUTPUT_RESULT" | jq -e '. | map(.test) | sort')" != '["test content 1","test content 3"]' ]; then
echo "Get matrix outputs result is not valid"
exit 1
fi
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/need-fix-to-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ on:
type: string
required: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
need-fix-to-issue:
runs-on: ${{ inputs.runs-on && fromJson(inputs.runs-on) || 'ubuntu-latest' }}
Expand Down
14 changes: 10 additions & 4 deletions actions/get-matrix-outputs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ inputs:
description: "Define weather to remove the downloaded artifact after reading."
required: false
default: "true"
token:
description: GitHub token with read and write access to actions for the repository.
default: ${{ github.token }}
required: false
outputs:
result:
description: "The matrix combined JSON outputs."
Expand All @@ -34,10 +38,11 @@ runs:
ARTIFACT_PATH="/tmp/$ARTIFACT_NAME"
echo "artifact-path=$ARTIFACT_PATH" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: ${{ steps.prepare-download.outputs.artifact-name }}
path: ${{ steps.prepare-download.outputs.artifact-path }}
pattern: ${{ steps.prepare-download.outputs.artifact-name }}-*
merge-multiple: true

- id: read-artifacts
uses: actions/github-script@v7
Expand All @@ -64,6 +69,7 @@ runs:
}
- if: ${{ inputs.remove-artifact == 'true' }}
uses: geekyeggo/delete-artifact@v2
uses: geekyeggo/delete-artifact@v4
with:
name: ${{ steps.prepare-download.outputs.artifact-name }}
token: ${{ inputs.token }}
name: ${{ steps.prepare-download.outputs.artifact-name }}-*
34 changes: 11 additions & 23 deletions actions/set-matrix-output/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,19 @@ runs:
const artifactName = `${{ github.run_id }}-${{ github.run_number }}-${{ inputs.artifact-name }}`;
core.setOutput("artifact-name", artifactName);
const artifactPath = join("/tmp",artifactName);
core.setOutput("artifact-path", artifactPath);
await io.mkdirP(artifactPath);
const maxAttempts = 10;
let matrixOutputFile = '';
for (let i = 1; i <= maxAttempts; i++) {
const uniquid = randomUUID();
const timestamp = Date.now();
const matrixOutputFileName = `${timestamp}-${artifactName}-${uniquid}.json`;
const uniquid = randomUUID();
const timestamp = Date.now();
const artifactUniqueName = `${artifactName}-${timestamp}-${uniquid}`;
core.setOutput("artifact-unique-name", artifactUniqueName);
matrixOutputFile = join(artifactPath, matrixOutputFileName);
if (!existsSync(matrixOutputFile)) {
break;
}
matrixOutputFile = '';
}
const artifactDirPath = join("/tmp",artifactUniqueName);
await io.mkdirP(artifactDirPath);
if (!matrixOutputFile) {
core.setFailed(`Failed to find unique file name after ${maxAttempts} attempts`);
}
writeFileSync(matrixOutputFile, `${{ inputs.value }}`);
const artifactPath = join(artifactDirPath, `${artifactUniqueName}.json`);
core.setOutput("artifact-path", artifactPath);
writeFileSync(artifactPath, `${{ inputs.value }}`);
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.prepare-upload.outputs.artifact-name }}
name: ${{ steps.prepare-upload.outputs.artifact-unique-name }}
path: ${{ steps.prepare-upload.outputs.artifact-path }}

0 comments on commit fecdab8

Please sign in to comment.