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

Retrieve ruleset.xml from private repository #41

Open
lilithebowman opened this issue Sep 11, 2020 · 1 comment
Open

Retrieve ruleset.xml from private repository #41

lilithebowman opened this issue Sep 11, 2020 · 1 comment

Comments

@lilithebowman
Copy link

Is it possible to have this script retrieve the ruleset from a private repository? That's what I've been trying to figure out for 2 days now.

I was able to write that script out in shell scripts. But I can't figure out how to make the PHPCS output be comments on the PR using command lines so I wanted to use your action if I could.

@lilithebowman
Copy link
Author

lilithebowman commented Sep 11, 2020

# Trigger the workflow on push or pull request
on: [pull_request]

name: Inspections
jobs:
  runPHPCSInspection:
    name: Run PHPCS inspection
    runs-on: ubuntu-latest
    steps:
    - name: Checkout PR files
      uses: actions/checkout@v2
      with:
        ref: ${{ github.event.pull_request.head.sha }}
    - name: Check out Our WPCS Rule Set
      uses: actions/checkout@v2
      with: 
        repository: CompanyName/our-wp-standard
        path: wpcs
        token: ${{ secrets.GH_BOT_TOKEN }}
    - name: Copy wpcs/Our-WP-Standard/ruleset.xml to phpcs.xml
      run: |
        cp wpcs/Our-WP-Standard/ruleset.xml phpcs.xml
        pwd
        ls -alF 
    - name: Run PHPCS inspection
      uses: rtCamp/[email protected]
      env:
        GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
        SKIP_FOLDERS: "tests,.github,Our-WP-Standard,wordpress/wp-admin, wordpress/wp-includes"
      with:
        args: "wpcs/Our-WP-Standard/ruleset.xml"

This is what I've tried so far.

It even appears to pick up on the phpcs.xml file.

It is ignoring most of the rules however. We added in the PR an array with inline syntax and array with terse syntax. Usually it should report that as an error for our rules, but it does not.

ruleset.xml

<?xml version="1.0"?>
<ruleset name="Our-Standard">
	<description>Our WordPress Coding Standards</description>

	<config name="installed_paths" value="vendor/wp-coding-standards/wpcs/" />

	<!-- Remove yoda condition from WordPress-Core ruleset -->
	<rule ref="vendor/wp-coding-standards/wpcs/WordPress-Core/ruleset.xml">
		<exclude name="WordPress.PHP.YodaConditions" />
	</rule>

	<!-- Excluding vendor directories -->
	<exclude-pattern>vendor/*</exclude-pattern>
	<!-- Excluding WordPress admin directories -->
	<exclude-pattern>wp-admin/*</exclude-pattern>
	<exclude-pattern>wp-includes/*</exclude-pattern>

	<!-- Tell code sniffer which rules to follow -->
	<rule ref="WordPress-Extra"/>

</ruleset>

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

1 participant