Skip to content

campaigns: allow partial publishing of changesets

Warren Gifford requested to merge aharvey/template-only-except into main

Created by: LawnGnome

This is a prototype of the option being presented in RFC 228. It needs to be used in conjunction with sourcegraph/sourcegraph#13476.

Note that this PR adds a dependency on https://github.com/LawnGnome/campaign-schema for schema-related code shared between this PR and sourcegraph/sourcegraph#13476; my intention is to move this to https://github.com/sourcegraph/campaignutils if accepted.

An example of the type of campaign you could run with this is:

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/*
  - 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:
    default: Hello World
    except:
      - github.com/sourcegraph/*: Hello Sourcegraph!
  body: My first campaign!
  branch: hello-world # Push the commit to this branch.
  commit:
    message: Append Hello World to all README.md files
  published:
    - github.com/LawnGnome/*: true

Merge request reports

Loading