From 8649b284d78dc32d57c31b709febbafec2761aaa Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 2 Dec 2026 00:08:01 +1300 Subject: [PATCH 1/2] Demo: only give our deploy job the permissions to deploy our demo app to GitHub Pages. --- .github/workflows/demo.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 51b1c34..eeb0fe3 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -5,10 +5,11 @@ on: branches: [main] workflow_dispatch: +# Our jobs can only read our repository by default, so that our build (which runs the install scripts of our +# dependencies) can't deploy anything. Only our deploy job can (see its permissions). + permissions: contents: read - pages: write - id-token: write # Only deploy one version of our demo app at a time, letting a deployment that has started finish, since cancelling it # could leave GitHub Pages in an inconsistent state. @@ -31,8 +32,6 @@ jobs: run: bun install --frozen-lockfile - name: Build OpenCOR Plot's demo app run: bun build:demo - - name: Configure GitHub Pages - uses: actions/configure-pages@v6 - name: Upload OpenCOR Plot's demo app uses: actions/upload-pages-artifact@v5 with: @@ -41,6 +40,11 @@ jobs: name: Deploy needs: build runs-on: ubuntu-26.04 + # Note: actions/deploy-pages needs to deploy to GitHub Pages and to get an OIDC token to prove where our demo app + # comes from (see https://github.com/actions/deploy-pages#usage). + permissions: + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} From d24d2852116b0bd6a19f0c759831bc1f5c4aa8fd Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 2 Dec 2026 00:14:42 +1300 Subject: [PATCH 2/2] Demo: documented that GitHub Pages must be enabled for our demo app to be deployed. --- .github/workflows/demo.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index eeb0fe3..ef4290d 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -40,8 +40,11 @@ jobs: name: Deploy needs: build runs-on: ubuntu-26.04 - # Note: actions/deploy-pages needs to deploy to GitHub Pages and to get an OIDC token to prove where our demo app - # comes from (see https://github.com/actions/deploy-pages#usage). + # Note #1: actions/deploy-pages needs to deploy to GitHub Pages and to get an OIDC token to prove where our demo app + # comes from (see https://github.com/actions/deploy-pages#usage). + # Note #2: GitHub Pages must have been enabled for our repository, with GitHub Actions as its source (see + # https://github.com/opencor/plot/settings/pages), since our GITHUB_TOKEN can't enable it (only a token + # with admin rights can, e.g. using actions/configure-pages with its enablement input). permissions: pages: write id-token: write