Repository navigation
chore(ci): add Dependabot updates, a dependency audit and the patch record template #190
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
816e5ac
chore(ci): add Dependabot updates, a dependency audit and the patch r…
smarcet 3f5186e
fix(ci): review development dependencies and detect a failed yarn audit
smarcet ffda39c
fix(ci): audit every yarn group, not only dependencies
smarcet 69bbfe2
ci: make the composer audit blocking
smarcet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <!-- | ||
| Patch record of a release. Create the release with: | ||
|
|
||
| gh release create vX.Y.Z --generate-notes --notes-file .github/RELEASE_NOTES_TEMPLATE.md | ||
|
|
||
| Then edit the release: fill in the fields below, and add the deploy date once the | ||
| release is running in production. | ||
| --> | ||
|
|
||
| ## Patch record | ||
|
|
||
| - Release tag: vX.Y.Z | ||
| - Deployed to production: YYYY-MM-DD | ||
| - Components updated: list them here. A grouped Dependabot pull request shows only its group name under "Dependency updates", so copy the packages from its description. | ||
| - CVEs and advisories addressed: none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Dependabot version updates. | ||
| # | ||
| # Update pull requests are opened on the first day of each month, so they are ready | ||
| # for the monthly patch cycle. Minor and patch updates are grouped into one pull | ||
| # request per ecosystem; a major update gets its own pull request. | ||
| # | ||
| # Security alerts do not depend on this file: they are a repository setting. | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "composer" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "monthly" | ||
| open-pull-requests-limit: 5 | ||
| groups: | ||
| composer-minor-and-patch: | ||
| patterns: | ||
| - "*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
|
|
||
| - package-ecosystem: "npm" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "monthly" | ||
| open-pull-requests-limit: 5 | ||
| groups: | ||
| npm-minor-and-patch: | ||
| patterns: | ||
| - "*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
|
|
||
| - package-ecosystem: "docker" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "monthly" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Categories for automatically generated release notes. | ||
| # Dependabot labels its pull requests "dependencies", so the components that a | ||
| # release updates are listed on their own for the patch record. | ||
| changelog: | ||
| categories: | ||
| - title: Dependency updates | ||
| labels: | ||
| - dependencies | ||
| - title: Other changes | ||
| labels: | ||
| - "*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| name: Dependency Audit | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| schedule: | ||
| - cron: '0 6 * * 1' # Mondays at 06:00 UTC | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # Blocks a pull request that adds a dependency, or updates one to a version, | ||
| # with a known vulnerability of high or critical severity. | ||
| dependency-review: | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out repository code | ||
| uses: actions/checkout@v4 | ||
| - name: Review dependency changes | ||
| uses: actions/dependency-review-action@v5.0.1 | ||
| with: | ||
| fail-on-severity: high | ||
| # The default covers runtime dependencies only. | ||
| fail-on-scopes: runtime, development, unknown | ||
|
|
||
| # Audits every dependency in the lock files. | ||
| # The Composer audit blocks. The Yarn audit only reports for now: main still | ||
| # has npm advisories that predate this workflow, so a blocking audit would | ||
| # fail every pull request. Remove its "continue-on-error" line once those | ||
| # advisories are patched or accepted. | ||
| audit: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| PHP_VERSION: 8.3 | ||
| steps: | ||
| - name: Check out repository code | ||
| uses: actions/checkout@v4 | ||
| - name: Install PHP | ||
| uses: "shivammathur/setup-php@v2" | ||
| with: | ||
| php-version: ${{env.PHP_VERSION}} | ||
| tools: composer:v2 | ||
| coverage: none | ||
| - name: Composer audit | ||
| run: composer audit --locked --abandoned=report --ignore-severity=low --ignore-severity=medium | ||
| - name: Install Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
| # Every group is audited: the frontend is bundled, so packages declared | ||
| # under devDependencies (react, superagent) also ship to the browser. | ||
| - name: Yarn audit | ||
| continue-on-error: true | ||
| run: | | ||
| set +e | ||
| # The exit code of yarn 1 cannot tell a failed audit from a clean one | ||
| # (both can be 1), so the result is read from the JSON summary. | ||
| yarn audit --json > yarn-audit.jsonl | ||
| summary=$(jq -c 'select(.type == "auditSummary") | .data.vulnerabilities' yarn-audit.jsonl | tail -n 1) | ||
| if [ -z "$summary" ]; then | ||
| echo "yarn audit did not complete:" | ||
| head -n 20 yarn-audit.jsonl | ||
| exit 1 | ||
| fi | ||
| echo "Vulnerabilities by severity: $summary" | ||
| if [ "$(echo "$summary" | jq '.high + .critical')" -gt 0 ]; then | ||
| yarn audit --level high | ||
| exit 1 | ||
| fi | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.