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
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

# Kept deliberately cheap. Typecheck only, on the branches that matter — the
# Kept deliberately cheap. Typecheck only, on the branches that matter: the
# end-to-end suite needs a desktop session, a GPU and ffmpeg, so it runs before
# a release on a real machine instead (see `npm run check:pre-release`).
on:
Expand All @@ -16,6 +16,11 @@ concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

# Reads the code and nothing else. Without this the token gets the
# repository's default, which can be write, for a job that only typechecks.
permissions:
contents: read

jobs:
check:
runs-on: windows-latest
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/publisher-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Publisher image
#
# Only when the publisher itself changes. It used to run on every release tag,
# which rebuilt an identical image for a release that had touched nothing in
# `publisher/` — the app and the publisher are versioned and shipped
# `publisher/`: the app and the publisher are versioned and shipped
# separately, and there is no reason for one to drag the other along.
on:
push:
Expand All @@ -17,6 +17,12 @@ on:
- '.github/workflows/publisher-image.yml'
workflow_dispatch:

# The image goes to Docker Hub with its own credentials, so the GitHub token
# only ever reads the checkout. The layer cache does not need a scope here:
# it authenticates with the runner's own token, not this one.
permissions:
contents: read

jobs:
image:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -76,7 +82,7 @@ jobs:
${{ secrets.PUBLISHER_IMAGE }}:${{ steps.meta.outputs.version }}
${{ secrets.PUBLISHER_IMAGE }}:latest
# Layers are cached between runs, so a change to one source file does
# not reinstall the dependencies again — which matters most for
# not reinstall the dependencies again, which matters most for
# arm64, where every command runs under emulation. Scoped by name so
# it cannot collide with another workflow's cache in this repository.
cache-from: type=gha,scope=publisher
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/compress.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ async function startFakePublisher(): Promise<FakePublisher> {
// The real publisher refuses every write without this, so the fake one does
// too: otherwise the test would pass whether or not the app sent it.
const gate: express.RequestHandler = (req, res, next) => {
const given = /^Bearer\s+(.+)$/i.exec(req.header('authorization') ?? '')?.[1];
if (given !== TOKEN) {
// Compared whole rather than parsed: this is a test's fake publisher,
// and the exact header GoodBit sends is the thing being checked.
if (req.header('authorization') !== `Bearer ${TOKEN}`) {
res.status(401).json({ message: 'Wrong or missing publish token.' });
return;
}
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/publishGoodBits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ async function startFakePublisher(): Promise<FakePublisher> {
const TOKEN = 'a-test-publish-token';

const gate: express.RequestHandler = (req, res, next) => {
const given = /^Bearer\s+(.+)$/i.exec(req.header('authorization') ?? '')?.[1];
if (given !== TOKEN) {
// Compared whole rather than parsed: this is a test's fake publisher,
// and the exact header GoodBit sends is the thing being checked.
if (req.header('authorization') !== `Bearer ${TOKEN}`) {
res.status(401).json({ message: 'Wrong or missing publish token.' });
return;
}
Expand Down
Loading