In actions/upload-artifact@v4, what happens if two parallel jobs upload artifacts with the same name?
Select an answer to reveal the explanation.
Short Explanation and Infographic
v4 enforces unique artifact names within a run — use matrix variable in the name like 'build-${{ matrix.os }}' to avoid conflicts.
Full explanation below image
Full Explanation
actions/upload-artifact@v4 introduced stricter artifact naming requirements compared to v3. In v4, artifact names must be unique within a workflow run. If parallel jobs attempt to upload artifacts with the same name, the second upload will fail with an error. The fix is to include a unique identifier in the artifact name: '${{ matrix.os }}-build-output' for matrix jobs, or any unique value like run ID, timestamp, or job name. v3 was more permissive and allowed overwriting. This breaking change in v4 improves artifact management predictability but requires updating matrix workflows.