campaigns: experiment with per-repo templates
Created by: LawnGnome
This is one possible approach to tackle sourcegraph/sourcegraph#13139, as described in RFC 228.
Basically, you can now replicate changesetTemplate
in individual OnQueryOrRepository
items. For example:
name: hello-world
description: Add Hello World to READMEs
# Find all repositories that contain a README.md file.
on:
- repositoriesMatchingQuery: file:README.md r:github.com/LawnGnome
changesetTemplate:
title: Hello Adam
body: Your first campaign?
branch: hello-world # Push the commit to this branch.
commit:
message: Append Hello World to all README.md files
published: true
- repositoriesMatchingQuery: file:README.md r:gitlab.sgdev.org
# In each repository, run this command. Each repository's resulting diff is captured.
steps:
- run: echo Hello World | tee -a $(find -name README.md)
container: alpine:3
# Describe the changeset (e.g., GitHub pull request) you want for each repository.
changesetTemplate:
title: Hello World
body: My first campaign!
branch: hello-world # Push the commit to this branch.
commit:
message: Append Hello World to all README.md files
published: false
In the event that a repo is matched by more than one OnQueryOrRepository
, the precedence is roughly (more detail in the RFC):
-
repository: exact repo
with a branch, with the tie breaker being the first item seen -
repository: exact repo
without a branch -
repositoriesMatchingQuery: search string
, with the tie breaker being the longer query - The campaign spec
changesetTemplate