Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting textdomain manually #184

Open
JUVOJustin opened this issue Oct 11, 2024 · 5 comments
Open

Allow setting textdomain manually #184

JUVOJustin opened this issue Oct 11, 2024 · 5 comments

Comments

@JUVOJustin
Copy link

First off thank you very much for the github action. I already implemented it in our plugin boilerplate CI: https://github.com/JUVOJustin/wordpress-plugin-boilerplate

However when the workflow clones the repo with a simple
- uses: actions/checkout@v4

And the repository has a different name than the textdomain configured in the plugin header, the pipeline seems to use the folders name inside the github action which is the repo name by default.

Example:
Repo: my-awesome-plugin
Textdomain: awesome-plugin

Result:
Mismatched text domain. Expected 'my-awesome-plugin' but got 'awesome-plugin'.

By passing the expected textdomain to the action this could be solved.

@swissspidy
Copy link
Member

You could also just do

- name: Checkout repository with correct slug
  uses: actions/checkout@v4
  with:
    path: 'awesome-plugin'

No need to reimplement this in this action :)

@swissspidy swissspidy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2024
@jcvignoli
Copy link

jcvignoli commented Nov 10, 2024

@swissspidy I have a similar issue and your trick doesn't work. My plugin is availabe on "/dist", and it's name is "my-plugin".

with the following config:

name: 'WP plugin check'
on:
  push:
    branches: "*"
  pull_request:
jobs:
  standard:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v4
      with:
        path: 'my-plugin'
            
    - name: Run plugin check
      uses: wordpress/plugin-check-action@v1
      with:
        build-dir: './dist'
        exclude-directories: 'vendor,.wordpress-org'

I get the following github error:

ℹ Starting 'wp plugin list-check-categories' on the cli container. 
name	slug
General	general
Plugin Repo	plugin_repo
Security	security
Performance	performance
Accessibility	accessibility
✔ Ran `wp plugin list-check-categories` in 'cli'. (in 0s 484ms)
ℹ Starting 'wp plugin get dist --field=requires_plugins' on the cli container. 
Error: The 'dist' plugin could not be found.
✖ Command failed with exit code 1
Command failed with exit code 1
Error: Process completed with exit code 1.

If I remove this part:

      with:
        path: 'my-plugin'

I get the original issue, Mismatched text domain. Expected 'dist' but got 'my-plugin'.

What should I do?

@jcvignoli
Copy link

I found a similar issue with the WP plugin, which could be resolved with --slug=my-plugin apparently.

@swissspidy
Copy link
Member

swissspidy commented Nov 10, 2024

Setting path: 'my-plugin' of course does not work if your actual built plugin file is in a differently named subfolder and you pass that one to Plugin Check.

I will consider adding support for --slug, but I worry that it will lead to issues with accidentally hiding legit issues. So it will need to be documented well.

In the meantime I recommend just renaming your folder.

  - name: Build plugin
    run: |
      mv ./dist ${{ runner.temp }}/my-plugin

  - name: Run plugin check
    uses: wordpress/[email protected]
    with:
      build-dir: ${{ runner.temp }}/my-plugin

@swissspidy swissspidy reopened this Nov 10, 2024
@jcvignoli
Copy link

@swissspidy Thanks, it worked out perfectly ;)

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

No branches or pull requests

3 participants