-
Notifications
You must be signed in to change notification settings - Fork 92
Conversation
.github/workflows/lint.yml
Outdated
pull_request: | ||
branches: [trunk] | ||
push: | ||
branches: [trunk,add/linting-github-actions] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should remove this branch from the array before merging.
Also @EvanHerman if you have a chance to review that would be great, thank you. |
.github/workflows/stylelint.yml
Outdated
- name: install node v12 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jffng I'm a big fan of Github Actions. Your workflows look really great!
Question about the Node version though. The current LTS is 14 (which has support well into 2023) in contrast, Node 12 has an end-of-life date of 2022-04-30.
Thoughts about using Node 14 LTS instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WordPress & Gutenberg's _official support is "LTS"
- https://github.com/WordPress/gutenberg/blob/trunk/.nvmrc#L1
- https://github.com/WordPress/wordpress-develop/blob/master/.nvmrc#L1
That said Gutenberg is still running Node.js v12 & v14 tests in GitHub Actions
Stylelint in the upcoming v14 release drops Node.js v10 support
With all that said, there's probably no need to use v12, switching to v14 should be fine
.github/workflows/stylelint.yml
Outdated
uses: actions-hub/stylelint@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PATTERN: "**/*.css" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good @jffng, a few more minor'ish suggestions
.github/workflows/lint.yml
Outdated
steps: | ||
# Checkout repository | ||
- name: Checkout | ||
uses: actions/checkout@v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest pinning these versions for all GitHub Actions, it ensures that only explicit versions are used, this is primarily I believe security related and is adhered to in the majority of P projects, e.g Gutenberg here for example:
These can be kept up-to-date with Dependabot:
.github/workflows/lint.yml
Outdated
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache composer dependencies | ||
uses: actions/cache@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uses: actions/cache@v1 | |
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 |
Updates v1 to the latest v2 release https://github.com/actions/cache/releases/tag/v2.1.6
.github/workflows/lint.yml
Outdated
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache composer dependencies | ||
uses: actions/cache@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uses: actions/cache@v1 | |
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 |
Updates v1 to the latest v2 release https://github.com/actions/cache/releases/tag/v2.1.6
.github/workflows/stylelint.yml
Outdated
steps: | ||
- uses: actions/checkout@v2 | ||
- name: install node v12 | ||
uses: actions/setup-node@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uses: actions/setup-node@v1 | |
uses: actions/setup-node@270253e841af726300e85d718a5f606959b2903c # v2.4.1 |
Upgrades v1 to the latest setup-node v2.4.1 release https://github.com/actions/setup-node/releases/tag/v2.4.1
@@ -0,0 +1,32 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,23 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file uses spaces for, it should use tabs, JSON files inherit the same settings from the [*] .editorconfig file pattern
Co-authored-by: Stephen Edgar <stephen@netweb.com.au>
@ntwb @gregrickaby thank for the reviews and feedback! I think I addressed it all, including:
Going to merge this, thanks again. |
@jffng Unsure if stylelint is actually working, it's not clear at all looking at the action run: https://github.com/WordPress/twentytwentytwo/runs/3860275082?check_suite_focus=true Run actions-hub/stylelint@master
env:
GITHUB_TOKEN: ***
PATTERN: **/*.css
/usr/bin/docker run --name fa4e1462043903626f4732ae6d2265fbc0d97a_c97241 --label fa4e14 --workdir /github/workspace --rm -e GITHUB_TOKEN -e PATTERN -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/twentytwentytwo/twentytwentytwo":"/github/workspace" fa4e14:62043903626f4732ae6d2265fbc0d97a
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
warning "stylelint" is already in "devDependencies". Please remove existing entry first before adding it to "dependencies".
**/*.css Also, the PHPCS run doesn't warn of the warnings: https://github.com/WordPress/twentytwentytwo/runs/3860275079?check_suite_focus=true Run composer standards:check -- --runtime-set ignore_warnings_on_exit true --runtime-set testVersion 5.8-
> @php ./vendor/squizlabs/php_codesniffer/bin/phpcs '--runtime-set' 'ignore_warnings_on_exit' 'true' '--runtime-set' 'testVersion' '5.8-'
W. 2 / 2 (100%)
FILE: index.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
1 | WARNING | No PHP code was found in this file and short open tags
| | are not allowed by this install of PHP. This file may
| | be using short open tags but PHP does not allow
| | them. (Internal.NoCodeFound)
----------------------------------------------------------------------
Time: 159ms; Memory: 6MB |
Note that some of the references below are not the only contributions (commits, PR review, helpful issue input, etc.) from these folks, but merely the first ones I encountered while reviewing items committed to `trunk` since the initial branch commit. @westonruter via WordPress#51 @ntwb via WordPress#73 @juricav via WordPress#113 @Sandstromer via WordPress#69 @jasmussen via WordPress#74 @melchoyce via WordPress#16 @Riyadh1734 via WordPress#182 @desrosj via WordPress#223 @beafialho via WordPress#172 @clucasrowlands via WordPress#171 @Otto42 via WordPress#28 @luminuu via WordPress#107 @felixarntz via WordPress#240
* add missing props to CONTRIBUTORS.md Note that some of the references below are not the only contributions (commits, PR review, helpful issue input, etc.) from these folks, but merely the first ones I encountered while reviewing items committed to `trunk` since the initial branch commit. @westonruter via #51 @ntwb via #73 @juricav via #113 @Sandstromer via #69 @jasmussen via #74 @melchoyce via #16 @Riyadh1734 via #182 @desrosj via #223 @beafialho via #172 @clucasrowlands via #171 @Otto42 via #28 @luminuu via #107 @felixarntz via #240 * add dotorg handles to CONTRIBUTORS.md * Fix Rich's WP.org username. Co-authored-by: Kjell Reigstad <kjell@kjellr.com>
Description
This PR is a simpler alternative to #26. (Does not include the pre-commit hook)
Testing Instructions
npm install && composer install
npm run lint:css
composer run analyze functions.php
composer run lint
composer run standards:check
composer run standards:fix