3232 - ' phpcs.xml.dist'
3333 # Changes to workflow files should always verify all workflows are successful.
3434 - ' .github/workflows/*.yml'
35+ workflow_dispatch :
36+
37+ # Cancels all previous workflow runs for pull requests that have not completed.
38+ concurrency :
39+ # The concurrency group contains the workflow name and the branch name for pull requests
40+ # or the commit hash for any other events.
41+ group : ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
42+ cancel-in-progress : true
3543
3644jobs :
3745 # Runs PHP coding standards checks.
4755 # - Logs PHP_CodeSniffer debug information.
4856 # - Runs PHPCS on the full codebase with warnings suppressed.
4957 # - Runs PHPCS on the `tests` directory without warnings suppressed.
50- # - todo: Configure Slack notifications for failing scans .
58+ # - Ensures version-controlled files are not modified or deleted .
5159 phpcs :
5260 name : PHP coding standards
5361 runs-on : ubuntu-latest
8694 - name : Check test suite files for warnings
8795 run : phpcs tests -q --report=checkstyle | cs2pr
8896
97+ - name : Ensure version-controlled files are not modified during the tests
98+ run : git diff --exit-code
99+
89100 # Runs the JavaScript coding standards checks.
90101 #
91102 # JSHint violations are not currently reported inline with annotations.
@@ -94,11 +105,10 @@ jobs:
94105 # - Checks out the repository.
95106 # - Logs debug information about the runner container.
96107 # - Installs NodeJS 14.
97- # - Sets up caching for NPM.
98108 # - Logs updated debug information.
99109 # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
100110 # - Run the WordPress JSHint checks.
101- # - todo: Configure Slack notifications for failing tests .
111+ # - Ensures version-controlled files are not modified or deleted .
102112 jshint :
103113 name : JavaScript coding standards
104114 runs-on : ubuntu-latest
@@ -118,18 +128,10 @@ jobs:
118128 svn --version
119129
120130 - name : Install NodeJS
121- uses : actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
131+ uses : actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
122132 with :
123133 node-version : 14
124-
125- - name : Cache NodeJS modules
126- uses : actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
127- env :
128- cache-name : cache-node-modules
129- with :
130- # npm cache files are stored in `~/.npm` on Linux/macOS
131- path : ~/.npm
132- key : ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
134+ cache : npm
133135
134136 - name : Log debug information
135137 run : |
@@ -141,3 +143,19 @@ jobs:
141143
142144 - name : Run JSHint
143145 run : npm run grunt jshint
146+
147+ - name : Ensure version-controlled files are not modified or deleted
148+ run : git diff --exit-code
149+
150+ slack-notifications :
151+ name : Slack Notifications
152+ uses : WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
153+ needs : [ phpcs, jshint ]
154+ if : ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
155+ with :
156+ calling_status : ${{ needs.phpcs.result == 'success' && needs.jshint.result == 'success' && 'success' || ( needs.phpcs.result == 'cancelled' || needs.jshint.result == 'cancelled' ) && 'cancelled' || 'failure' }}
157+ secrets :
158+ SLACK_GHA_SUCCESS_WEBHOOK : ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
159+ SLACK_GHA_CANCELLED_WEBHOOK : ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
160+ SLACK_GHA_FIXED_WEBHOOK : ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
161+ SLACK_GHA_FAILURE_WEBHOOK : ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
0 commit comments