2020-10-15 19:40:33 +00:00
|
|
|
name: Coding Standards
|
|
|
|
|
|
|
|
on:
|
2021-02-24 19:34:41 +00:00
|
|
|
# JSHint was introduced in WordPress 3.8.
|
|
|
|
# PHPCS checking was introduced in WordPress 5.1.
|
2020-10-15 19:40:33 +00:00
|
|
|
push:
|
|
|
|
branches:
|
2021-03-02 15:26:03 +00:00
|
|
|
- trunk
|
2021-02-12 16:01:54 +00:00
|
|
|
- '3.[89]'
|
|
|
|
- '[4-9].[0-9]'
|
|
|
|
tags:
|
2022-07-20 18:39:16 +00:00
|
|
|
- '[0-9]+.[0-9]'
|
|
|
|
- '[0-9]+.[0-9].[0-9]+'
|
|
|
|
- '!3.7.[0-9]+'
|
2020-10-15 19:40:33 +00:00
|
|
|
pull_request:
|
2021-02-24 19:34:41 +00:00
|
|
|
branches:
|
2021-03-02 15:26:03 +00:00
|
|
|
- trunk
|
2021-02-24 19:34:41 +00:00
|
|
|
- '3.[89]'
|
|
|
|
- '[4-9].[0-9]'
|
2021-03-02 19:57:15 +00:00
|
|
|
paths:
|
|
|
|
# Any change to a PHP or JavaScript file should run checks.
|
|
|
|
- '**.js'
|
|
|
|
- '**.php'
|
2022-10-19 18:18:45 +00:00
|
|
|
# These files configure npm. Changes could affect the outcome.
|
2021-03-02 19:57:15 +00:00
|
|
|
- 'package*.json'
|
|
|
|
# These files configure Composer. Changes could affect the outcome.
|
|
|
|
- 'composer.*'
|
|
|
|
# This file configures JSHint. Changes could affect the outcome.
|
|
|
|
- '.jshintrc'
|
|
|
|
# This file configures PHPCS. Changes could affect the outcome.
|
|
|
|
- 'phpcs.xml.dist'
|
2024-10-18 14:00:27 +00:00
|
|
|
# Confirm any changes to relevant workflow files.
|
|
|
|
- '.github/workflows/coding-standards.yml'
|
|
|
|
- '.github/workflows/reusable-coding-standards-*.yml'
|
2021-03-26 13:06:43 +00:00
|
|
|
workflow_dispatch:
|
2020-10-15 19:40:33 +00:00
|
|
|
|
2021-05-19 17:36:54 +00:00
|
|
|
# Cancels all previous workflow runs for pull requests that have not completed.
|
|
|
|
concurrency:
|
|
|
|
# The concurrency group contains the workflow name and the branch name for pull requests
|
|
|
|
# or the commit hash for any other events.
|
|
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2023-05-03 22:15:27 +00:00
|
|
|
# Disable permissions for all available scopes by default.
|
|
|
|
# Any needed permissions should be configured at the job level.
|
|
|
|
permissions: {}
|
|
|
|
|
2020-10-15 19:40:33 +00:00
|
|
|
jobs:
|
2024-05-17 17:41:40 +00:00
|
|
|
# Runs the PHP coding standards checks.
|
2020-10-15 19:40:33 +00:00
|
|
|
phpcs:
|
|
|
|
name: PHP coding standards
|
2024-05-17 17:41:40 +00:00
|
|
|
uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk
|
2023-05-03 22:15:27 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2020-12-09 20:05:01 +00:00
|
|
|
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
|
|
|
|
2020-10-15 19:40:33 +00:00
|
|
|
# Runs the JavaScript coding standards checks.
|
|
|
|
jshint:
|
|
|
|
name: JavaScript coding standards
|
2024-05-17 17:41:40 +00:00
|
|
|
uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
|
2023-05-03 22:15:27 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2020-12-09 20:05:01 +00:00
|
|
|
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
2021-10-20 14:40:47 +00:00
|
|
|
|
|
|
|
slack-notifications:
|
|
|
|
name: Slack Notifications
|
2021-11-10 20:58:15 +00:00
|
|
|
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
2023-05-03 23:20:40 +00:00
|
|
|
permissions:
|
|
|
|
actions: read
|
|
|
|
contents: read
|
2021-10-20 14:40:47 +00:00
|
|
|
needs: [ phpcs, jshint ]
|
2021-10-25 20:26:45 +00:00
|
|
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
2021-11-03 14:54:20 +00:00
|
|
|
with:
|
2023-09-22 14:28:01 +00:00
|
|
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
2021-10-20 19:51:00 +00:00
|
|
|
secrets:
|
2021-10-20 19:25:12 +00:00
|
|
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
|
|
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
|
|
|
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
|
|
|
|
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
|
2022-08-26 19:19:11 +00:00
|
|
|
|
|
|
|
failed-workflow:
|
|
|
|
name: Failed workflow tasks
|
|
|
|
runs-on: ubuntu-latest
|
2023-05-03 22:15:27 +00:00
|
|
|
permissions:
|
|
|
|
actions: write
|
2022-08-26 19:19:11 +00:00
|
|
|
needs: [ phpcs, jshint, slack-notifications ]
|
|
|
|
if: |
|
|
|
|
always() &&
|
|
|
|
github.repository == 'WordPress/wordpress-develop' &&
|
|
|
|
github.event_name != 'pull_request' &&
|
2022-08-31 14:29:22 +00:00
|
|
|
github.run_attempt < 2 &&
|
2022-08-26 19:19:11 +00:00
|
|
|
(
|
2023-09-22 14:28:01 +00:00
|
|
|
contains( needs.*.result, 'cancelled' ) ||
|
|
|
|
contains( needs.*.result, 'failure' )
|
2022-08-26 19:19:11 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Dispatch workflow run
|
2023-12-18 15:18:30 +00:00
|
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
2022-08-26 19:19:11 +00:00
|
|
|
with:
|
2022-09-28 01:53:48 +00:00
|
|
|
retries: 2
|
|
|
|
retry-exempt-status-codes: 418
|
2022-08-26 19:19:11 +00:00
|
|
|
script: |
|
|
|
|
github.rest.actions.createWorkflowDispatch({
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
workflow_id: 'failed-workflow.yml',
|
2022-10-24 15:18:37 +00:00
|
|
|
ref: 'trunk',
|
2022-08-26 19:19:11 +00:00
|
|
|
inputs: {
|
|
|
|
run_id: '${{ github.run_id }}'
|
|
|
|
}
|
|
|
|
});
|