|
| 1 | +Workflow And Action Validation |
| 2 | +============================== |
| 3 | + |
| 4 | +Workflow, local-action, and packaged-wrapper changes MUST receive an explicit |
| 5 | +validation strategy during review. These surfaces often fail only after merge, |
| 6 | +after a workflow-dispatched run, or after a bot-authored commit exercises a |
| 7 | +path that normal pull-request CI does not trigger. |
| 8 | + |
| 9 | +When To Apply |
| 10 | +------------- |
| 11 | + |
| 12 | +Use this checklist whenever a pull request touches any of these surfaces: |
| 13 | + |
| 14 | +- ``.github/workflows/**`` |
| 15 | +- ``.github/actions/**`` |
| 16 | +- ``resources/github-actions/**`` |
| 17 | +- workflow-related docs that describe permissions, dispatching, branch |
| 18 | + protection, sync behavior, generated previews, or release automation |
| 19 | + |
| 20 | +Required Questions |
| 21 | +------------------ |
| 22 | + |
| 23 | +Ask these questions before deciding the workflow surface is safe: |
| 24 | + |
| 25 | +- Does the workflow or action push commits with ``GITHUB_TOKEN``? |
| 26 | +- If it pushes bot-authored commits, do required checks run, get dispatched, or |
| 27 | + get mirrored for the new commit? |
| 28 | +- Are the required permissions declared in both the reusable workflow and any |
| 29 | + packaged consumer wrapper? |
| 30 | +- Are local composite action paths available from the repository and ref used |
| 31 | + by the workflow? |
| 32 | +- Does the changed automation behave correctly for same-repository pull |
| 33 | + requests, forked pull requests, ``push``, ``workflow_dispatch``, and |
| 34 | + ``workflow_call`` where those events are supported? |
| 35 | +- Does the workflow rely on files from ``main`` that might not exist in a |
| 36 | + consumer repository or in the installed DevTools package version? |
| 37 | +- Does the workflow update generated state such as ``.github/wiki``, Pages |
| 38 | + previews, release notes, changelog entries, labels, or project metadata? |
| 39 | +- Does the workflow need queueing, cancellation, or required-check mirroring so |
| 40 | + branch protection sees the latest commit state? |
| 41 | + |
| 42 | +Validation Strategies |
| 43 | +--------------------- |
| 44 | + |
| 45 | +Prefer deterministic local validation when it can cover the changed behavior: |
| 46 | + |
| 47 | +- run ``bash -n`` for shell scripts; |
| 48 | +- parse changed YAML files or run ``actionlint`` after ensuring it is available; |
| 49 | +- use fake ``gh`` and ``git`` wrappers to exercise action scripts without |
| 50 | + calling GitHub; |
| 51 | +- create temporary Git repositories to validate merge, rebase, conflict, |
| 52 | + branch, tag, or submodule behavior; |
| 53 | +- run changed PHP helper scripts directly against synthetic fixtures; |
| 54 | +- verify packaged wrapper inputs, permissions, and reusable workflow paths stay |
| 55 | + aligned with the canonical workflow. |
| 56 | + |
| 57 | +Actionlint Availability |
| 58 | +----------------------- |
| 59 | + |
| 60 | +When workflow files are changed, prefer running ``actionlint`` locally. If it is |
| 61 | +missing, install it before review when the platform has a safe package manager: |
| 62 | + |
| 63 | +- macOS with Homebrew: ``brew install actionlint``; |
| 64 | +- macOS with MacPorts: ``sudo port install actionlint``; |
| 65 | +- Debian-based Linux: download the official ``actionlint`` release archive for |
| 66 | + the host architecture, unpack the binary into a temporary directory, and run |
| 67 | + it from there or install it into a user-local ``PATH`` such as |
| 68 | + ``~/.local/bin``. |
| 69 | + |
| 70 | +``actionlint`` is distributed as a Go binary. It may use ``shellcheck`` for |
| 71 | +``run:`` blocks, and Homebrew installs that dependency automatically. On |
| 72 | +Windows, prefer WSL for now unless the repository already documents a native |
| 73 | +Windows installation path. |
| 74 | + |
| 75 | +Use the broadest relevant command for the changed surfaces, for example: |
| 76 | + |
| 77 | +.. code-block:: bash |
| 78 | + |
| 79 | + actionlint .github/workflows/*.yml resources/github-actions/*.yml |
| 80 | + |
| 81 | +Record the command and result in the review evidence. If installation is not |
| 82 | +possible, record that as a residual validation gap instead of silently skipping |
| 83 | +workflow linting. |
| 84 | + |
| 85 | +When local simulation cannot cover the behavior, call out the gap and prefer a |
| 86 | +temporary validation branch or pull request. Close that validation PR after |
| 87 | +recording the evidence in the real PR or issue. Do not require noisy temporary |
| 88 | +PRs for every workflow change when a deterministic local harness covers the |
| 89 | +risk. |
| 90 | + |
| 91 | +Bot-Authored Commit Rule |
| 92 | +------------------------ |
| 93 | + |
| 94 | +Any workflow that pushes commits with ``GITHUB_TOKEN`` MUST be reviewed for |
| 95 | +required-check side effects. GitHub usually does not trigger another normal |
| 96 | +``pull_request`` workflow run for commits pushed by the built-in workflow |
| 97 | +token. If branch protection requires checks on the latest commit, the workflow |
| 98 | +SHOULD dispatch the required workflow or publish matching commit statuses for |
| 99 | +that bot-authored commit. |
| 100 | + |
| 101 | +Review Output Expectations |
| 102 | +-------------------------- |
| 103 | + |
| 104 | +The review MUST record one of the following: |
| 105 | + |
| 106 | +- validation evidence, including commands, harnesses, or GitHub runs used; |
| 107 | +- a concrete finding when validation reveals a bug or missing permission; |
| 108 | +- a residual-risk note when the behavior cannot be exercised before merge. |
| 109 | + |
| 110 | +If the pull request body already contains sufficient validation evidence, |
| 111 | +reference it and verify that it covers the changed automation path. If the body |
| 112 | +does not, call out the missing validation in the review. |
0 commit comments