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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [main]
branches: [main, "integration/*"]
paths:
- "apps/**"
- "packages/**"
Expand All @@ -20,7 +20,7 @@ on:
- "install-cli.sh"
- "website/install-cli.sh"
pull_request:
branches: [main]
branches: [main, "integration/*"]
paths:
- "apps/**"
- "packages/**"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ name: Secret Scan

on:
pull_request:
branches: [main]
branches: [main, "integration/*"]
push:
branches: [main]
branches: [main, "integration/*"]
schedule:
# Weekly full-history sweep (Mondays 07:00 UTC): catches anything reachable
# only from history and re-scans as gitleaks' default rules evolve.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pin-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Pin GitHub Actions

on:
push:
branches: [main]
branches: [main, "integration/*"]
paths:
- ".github/workflows/**"
- ".github/pinact.yaml"
pull_request:
branches: [main]
branches: [main, "integration/*"]
paths:
- ".github/workflows/**"
- ".github/pinact.yaml"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: Deploy site to Pages

on:
push:
branches: ["main"]
branches: ["main", "integration/*"]
paths:
- "website/**"
- ".github/workflows/static.yml"
pull_request:
branches: ["main"]
branches: ["main", "integration/*"]
paths:
- "website/**"
- ".github/workflows/static.yml"
Expand Down
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,29 @@ MongoDB is CosmosDB-compatible — avoid MongoDB features that CosmosDB's MongoD
See [Reviewing and merging community contributions](#reviewing-and-merging-community-contributions)
for what to expect, including our acknowledgement target and follow-up on PRs waiting for a response.

### Integration branches

Most PRs target `main`. When several PRs need to land together, a maintainer
can create `integration/<initiative>` from current upstream `main`. Use a
single segment after `integration/`: `integration/taxonomy` matches the CI
filters; `integration/taxonomy/part-one` does not.

Open each component PR against the initiative branch. Review and merge those
PRs there, keeping the initiative branch up to date with `main`. When the
combined change is ready, open one PR from `integration/<initiative>` into
`main`. After it merges, delete the initiative branch.

CI, secret scanning, action pinning, and the website build run on pushes to
and PRs targeting initiative branches, subject to their usual path filters.
Only `main` uploads and deploys Pages artifacts; CLI publishing still requires
a manual dispatch on upstream `main`.

Workflow triggers do not protect branches. To enforce reviews or required
checks, a repository administrator must separately configure a GitHub branch
ruleset targeting `integration/*`. Keep the `main` ruleset intact and choose
required checks that report on every applicable PR: a path-filtered workflow
can leave a required check pending when it does not run.

### Recording a demo

For user-visible changes (Portal/CLI features or UX changes), attach a short recording in the PR's
Expand Down
30 changes: 29 additions & 1 deletion scripts/ci-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { spawnSync } from "node:child_process";
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
import { createRequire } from "node:module";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { join, posix, resolve } from "node:path";
import { afterEach, describe, expect, it } from "vitest";

// Reuse shared's existing YAML dependency, as the worker Dockerfiles do.
Expand Down Expand Up @@ -160,6 +160,34 @@ describe("GitHub Action pinning", () => {
});
});

describe("Integration branch CI", () => {
it.each(["ci", "gitleaks", "pin-actions", "static"])("%s checks pushes and PR bases for a single initiative", (name) => {
const { on } = parse(readFileSync(`.github/workflows/${name}.yml`, "utf8")) as {
on: Record<"push" | "pull_request", { branches: string[] }>;
};

// Both events filter the destination branch, not the contributor's topic branch.
for (const event of ["push", "pull_request"] as const) {
const matches = (branch: string) => on[event].branches.some((pattern) => posix.matchesGlob(branch, pattern));
expect(matches("main"), event).toBe(true);
expect(matches("integration/taxonomy"), event).toBe(true);
expect(matches("integration/cli-refresh"), event).toBe(true);
expect(matches("feature/taxonomy"), event).toBe(false);
expect(matches("integration/taxonomy/part-one"), event).toBe(false);
}
});

it("builds the site on integration branches without uploading or deploying Pages", () => {
const { jobs } = parse(readFileSync(".github/workflows/static.yml", "utf8")) as { jobs: Record<string, Job> };
expect(jobs.build.if).toBeUndefined();
for (const action of ["actions/configure-pages", "actions/upload-pages-artifact"]) {
const step = jobs.build.steps.find(({ uses }) => uses?.startsWith(`${action}@`));
expect(step?.if, action).toBe("github.ref == 'refs/heads/main'");
}
expect(jobs.deploy.if).toBe("github.ref == 'refs/heads/main'");
});
});

describe("CI execution prerequisites", () => {
it("selects integration checks for workflow changes through a dedicated filter", () => {
const filtersStep = jobs["detect-changes"].steps.find((candidate) => candidate.uses?.startsWith("dorny/paths-filter@"));
Expand Down
6 changes: 4 additions & 2 deletions website/src/content/docs/resources/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ for coding conventions, testing requirements, and the pull request process.

## Pull requests

Open pull requests against `microsoft/scope` on `main`, including when working
from a fork. Keep changes focused, include appropriate tests, and update
Open pull requests against `microsoft/scope`, including when working from a
fork. Target `main` unless your change belongs to a maintainer's
[integration branch](https://github.com/microsoft/scope/blob/main/CONTRIBUTING.md#integration-branches).
Keep changes focused, include appropriate tests, and update
affected documentation. See
[Reviewing and merging community contributions](https://github.com/microsoft/scope/blob/main/CONTRIBUTING.md#reviewing-and-merging-community-contributions)
for what to expect during review, including acknowledgement and follow-up
Expand Down
Loading