Composite GitHub/Forgejo Action: sc deploy on PR open, sc stop on PR close
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-25 23:32:26 +00:00
docs Auto-detect mode/deployment from the trigger; add deployment report and registry 2026-08-26 01:12:37 +02:00
action.yml Auto-detect mode/deployment from the trigger; add deployment report and registry 2026-08-26 01:12:37 +02:00
README.md Auto-detect mode/deployment from the trigger; add deployment report and registry 2026-08-26 01:12:37 +02:00

sc PR environment

One someones.computer deployment per pull request, a persistent staging deployment that tracks your default branch, a production deployment that tracks a prod tag, and one deployment per other branch — all from a single job, no per-trigger config. Wraps the sc CLI.

Quick start

You need an application already created on the platform, and an API token from that app's organization (Settings → API tokens) saved as a repo secret (SC_TOKEN below).

# .github/workflows/deploy.yml
name: Deploy

on:
  pull_request:
    types: [opened, synchronize, reopened, closed]
  push:
    branches: ['**']
    tags: [prod]

concurrency:
  group: sc-${{ github.event.pull_request.number || github.ref_name }}
  cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - name: Deploy to someones.computer
        uses: https://git.grey.ooo/Grey.ooo/someones.computer_pr-environment-action@main
        with:
          app: my-app
          token: ${{ secrets.SC_TOKEN }}

That's the whole setup. One job, no mode, no deployment — both are inferred from what triggered the run:

Trigger Deployment Mode
PR opened / synchronized / reopened pr-<number> up
PR closed pr-<number> down
Push to the default branch staging up
Push of the prod tag production up
Push to any other branch branch name, sanitized up
Deletion of any branch/tag above matching deployment down

Once a deploy finishes, it also posts (and keeps updated) a PR comment with the deployment's live endpoint URLs — that's what pull-requests: write is for.

uses: needs the full URL, not owner/repo@ref — this Forgejo instance resolves a bare owner/repo against github.com, not itself. Pin to a commit SHA instead of @main for reproducible CI.

Inputs

Only app and token are required — everything else has a sensible default.

Input Default What
app Application slug (required)
token API token, pass as a secret (required)
mode inferred up or down — override the trigger-based inference
deployment inferred Deployment name — override the trigger-based inference
staging-branch repo default branch Branch that maps to the staging deployment
production-tag prod Tag that maps to the production deployment
comment true Post the deployment report on the PR
github-token github.token Token for the PR comment (needs pull-requests: write)
endpoint production sc --endpoint (platform API base URL)
staging false sc --staging shorthand — a platform endpoint, unrelated to the staging deployment name above
org Disambiguates a token whose user belongs to several orgs
checkout true Check out the triggering commit before deploying
channel stable sc release channel to install
extra-args Extra arguments appended to sc deploy

Outputs

Output What
mode The resolved mode (up or down)
deployment The resolved deployment name
endpoints Raw JSON of the deployment's live endpoints from the platform API

More

  • Exact trigger-resolution rules, the deployment report, and how to split this into separate jobs instead of one: docs/reference.md.
  • Who's actually using this, and how each app is wired up: docs/registry.md.
  • Why PR environments exist, and the platform side of this action: docs/pr-environments.md in the platform repo.
  • This is a separate public repo (not inside the private platform repo) because Forgejo clones a cross-repo uses: action anonymously — a private source means every consumer's CI gets a 403.