Skip to content

Fix artifact name conflict when running action multiple times in matrix builds - #478

Merged
swissspidy merged 2 commits into
mainfrom
copilot/fix-plugin-check-action-in-monorepo
Jan 3, 2026
Merged

Fix artifact name conflict when running action multiple times in matrix builds#478
swissspidy merged 2 commits into
mainfrom
copilot/fix-plugin-check-action-in-monorepo

Conversation

Copilot AI commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

When invoking plugin-check-action multiple times in a matrix build (e.g., for multiple plugins in a monorepo), all runs after the first fail with a 409 Conflict error because they attempt to upload artifacts with the same hardcoded name.

Changes

  • Modified artifact name in action.yml to append the slug input when provided:
    name: plugin-check-results${{ inputs.slug && format('-{0}', inputs.slug) || '' }}

Behavior

Without slug (backward compatible):

uses: wordpress/plugin-check-action@v1
# Artifact: plugin-check-results

With slug in matrix:

uses: wordpress/plugin-check-action@v1
with:
  slug: ${{ matrix.plugin }}
# Artifacts: plugin-check-results-plugin-a, plugin-check-results-plugin-b, etc.

Each matrix job now generates a uniquely named artifact, eliminating the conflict.

Original prompt

This section details on the original issue you should resolve

<issue_title>Unable to invoke invoke plugin-check-action repeatedly for plugins in monorepo</issue_title>
<issue_description>I'm attempting to incorporate the plugin-check-action into the Performance Lab repo: WordPress/performance#2320. What is somewhat unique (but not at all uncommon) is that there are multiple plugins located in the repo, and I'm needing to run the action multiple times with each build-dir:

            - name: Run plugin check
              uses: wordpress/plugin-check-action@ec9b3fe9beaa76bcc4510b7ba2cb5855a5f80f3f # v1.1.4
              with:
                  build-dir: ./build/${{ matrix.plugin }}
                  slug: ${{ matrix.plugin }}
                  wp-version: ${{ matrix.wordpress }}
                  ignore-codes: 'readme_reserved_contributors,WordPress.WP.I18n.TextDomainMismatch'

However, as noted in WordPress/performance#2320 (comment), this is not working for all of the plugins due to the actions/upload-artifact action in plugin-check-action:

    - name: Upload artifact
      uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
      if: ${{ always() }}
      with:
        name: plugin-check-results
        path: ${{ runner.temp }}/plugin-check-results.txt
        if-no-files-found: ignore

One of the plugins in the matrix is successful and ends with:

With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 391
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact zip is 0ddcffbbee9569e0312e752d4a9a0c186878596312c8834d2a3e79768031f56f
Finalizing artifact upload
Artifact plugin-check-results.zip successfully finalized. Artifact ID 5011868518
Artifact plugin-check-results has been successfully uploaded! Final size is 391 bytes. Artifact ID is 5011868518
Artifact download URL: https://github.com/WordPress/performance/actions/runs/20670318722/artifacts/5011868518

However, all other plugins in the matrix fail with:

With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run

It seems that the artifact name needs to vary by the slug or something:

-         name: plugin-check-results
+         name: plugin-check-results${{ inputs.slug ? '-' + inputs.slug : '' }}
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix invocation of plugin-check-action for multiple plugins Fix artifact name conflict when running action multiple times in matrix builds Jan 3, 2026
Copilot AI requested a review from swissspidy January 3, 2026 08:53
@github-actions

github-actions Bot commented Jan 3, 2026

Copy link
Copy Markdown

🔍 WordPress Plugin Check Report

❌ Status: Failed

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
9 8 1

❌ Errors (8)

📁 hello.php (7 errors)
📍 Line 🔖 Check 💬 Message
0 plugin_header_no_license Missing "License" in Plugin Header. Please update your Plugin Header with a valid GPLv2 (or later) compatible license.
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
49 WordPress.WP.AlternativeFunctions.rand_mt_rand mt_rand() is discouraged. Use the far less predictable wp_rand() instead.
62 WordPress.Security.EscapeOutput.OutputNotEscaped All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
62 WordPress.WP.I18n.TextDomainMismatch Mismatched text domain. Expected 'hello-dolly-copy' but got 'hello-dolly'.
63 WordPress.Security.EscapeOutput.OutputNotEscaped All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$lang'.
64 WordPress.Security.EscapeOutput.OutputNotEscaped All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$chosen'.
📁 readme.txt (1 error)
📍 Line 🔖 Check 💬 Message
0 no_plugin_readme The plugin readme.txt does not exist.

⚠️ Warnings (1)

📁 hello.php (1 warning)
📍 Line 🔖 Check 💬 Message
72 WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound Functions declared in the global namespace by a theme/plugin should start with the theme/plugin prefix. Found: "dolly_css".

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@swissspidy
swissspidy requested a review from westonruter January 3, 2026 10:11
@swissspidy
swissspidy marked this pull request as ready for review January 3, 2026 10:11
@swissspidy
swissspidy requested a review from Copilot January 3, 2026 10:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes artifact name conflicts that occur when running the plugin-check-action multiple times in matrix builds (e.g., for monorepos with multiple plugins). The solution appends the slug input to the artifact name when provided, ensuring each matrix job generates a uniquely named artifact.

Key Changes:

  • Modified the artifact upload name to conditionally include the slug suffix
  • Updated package-lock.json with peer dependency metadata

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
action.yml Modified artifact name on line 196 to append -{slug} when the slug input is provided, using the same conditional pattern as other inputs in the action
package-lock.json Added "peer": true flags to numerous dependencies - standard npm metadata update that doesn't affect functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@swissspidy
swissspidy merged commit 1af5f79 into main Jan 3, 2026
8 checks passed
@swissspidy
swissspidy deleted the copilot/fix-plugin-check-action-in-monorepo branch January 3, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to invoke invoke plugin-check-action repeatedly for plugins in monorepo

4 participants