Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# CodeQL static analysis of the TypeScript sources; findings appear under Security > Code scanning.
name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "29 4 * * 3"

permissions:
contents: read

jobs:
analyze:
name: CodeQL analysis
runs-on: ubuntu-latest
permissions:
security-events: write # upload the analysis
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: github/codeql-action/init@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4
with:
languages: javascript-typescript, actions
# Bundled and third-party code only adds noise alerts.
config: |
paths-ignore: [action/dist, dist, node_modules]
- uses: github/codeql-action/analyze@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4
16 changes: 9 additions & 7 deletions .github/workflows/opendrs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dogfood: score this repository's own PRs and approve the low-risk ones (.opendrs.yml), and
# auto-merge only those that are also a captain "quick confirm", once the required checks pass.
# Runs the RELEASED action (@v0), never the PR's own copy: a PR must not be able to edit the
# code that decides whether to approve it.
# Runs a RELEASED action, pinned to a release commit that Dependabot bumps, never the PR's own
# copy: a PR must not be able to edit the code that decides whether to approve it.
name: OpenDRS

on:
Expand All @@ -13,17 +13,19 @@ concurrency:
group: opendrs-${{ github.event.pull_request.number }}
cancel-in-progress: true

# GITHUB_TOKEN only checks out and, on fork PRs, comments; the opendrs-bot app token below does
# the rest, including enabling auto-merge.
permissions:
contents: read
pull-requests: write
checks: read

jobs:
opendrs:
name: Score, label and approve
runs-on: ubuntu-latest
# GITHUB_TOKEN only checks out and, on fork PRs, comments; the opendrs-bot app token below does
# the rest, including enabling auto-merge. Write access is granted here, not at the top level.
permissions:
contents: read
pull-requests: write
checks: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -38,7 +40,7 @@ jobs:
with:
client-id: ${{ vars.OPENDRS_APP_CLIENT_ID }}
private-key: ${{ secrets.OPENDRS_APP_PRIVATE_KEY }}
- uses: error-path/opendrs@v0
- uses: error-path/opendrs@a746b7bd335008fcd03a8857aa0fd8c43c8190ce # v0.7.0
id: opendrs
with:
github-token: ${{ steps.app-token.outputs.token || github.token }}
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# OpenSSF Scorecard: grades this repository's supply-chain security practices and publishes the
# result to api.scorecard.dev (the README badge). The scorecard action refuses to publish if this
# workflow gains other steps, top-level write permissions or unpinned actions, so keep it this small.
name: Scorecard

on:
push:
branches: [main]
schedule:
- cron: "17 3 * * 1"
branch_protection_rule:
workflow_dispatch:

permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
security-events: write # upload the results to code scanning
id-token: write # sign the published results
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0
with:
results_file: results.sarif
results_format: sarif
publish_results: true
- uses: github/codeql-action/upload-sarif@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ auto-approved into the merge queue while risky ones still wait for a human.**
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-opendrs%20PR%20Risk%20Score%20and%20Blast%20Radius-2ea44f?logo=github)](https://github.com/marketplace/actions/opendrs-diff-risk-score)
[![CI](https://github.com/error-path/opendrs/actions/workflows/ci.yml/badge.svg)](https://github.com/error-path/opendrs/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/error-path/opendrs/badge)](https://scorecard.dev/viewer/?uri=github.com/error-path/opendrs)

AI agents now write and review code faster than people can read it, so human review has become
the bottleneck. Most pull requests are low risk, and a few cause most incidents. opendrs measures
Expand Down
3 changes: 3 additions & 0 deletions docs/maintaining.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ A short runbook for the maintainer.
git push origin v0.2.0 && git push -f origin v0
```

This repository's own dogfood (`.github/workflows/opendrs.yml`) pins the action by commit, so
it does not follow `v0`: bump its SHA and `# vX.Y.Z` comment in a PR, or merge Dependabot's.

4. Create a GitHub release from the tag with the changelog section as notes, with **Publish this
Action to the GitHub Marketplace** ticked: that is what updates the Marketplace listing from
`action.yml`. The form refuses a `description` of 125 characters or more (a test in
Expand Down
2 changes: 1 addition & 1 deletion tests/action/workflows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("workflows that run the Action", () => {
expect(check.name).toBeUndefined();
});

it.each(["ci", "opendrs", "pages", "publish"])("this repo's %s workflow and its jobs have descriptive names", (file) => {
it.each(["ci", "codeql", "opendrs", "pages", "publish", "scorecard"])("this repo's %s workflow and its jobs have descriptive names", (file) => {
const wf = parse(read(`.github/workflows/${file}.yml`));
// A set name, not GitHub's default (the bare file name), which says little in the Actions tab.
expect(wf.name).toMatch(/[A-Z]/);
Expand Down