Skip to content

campaigns: experiment with per-repo templates #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

LawnGnome
Copy link
Contributor

@LawnGnome LawnGnome commented Aug 26, 2020

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):

  1. repository: exact repo with a branch, with the tie breaker being the first item seen
  2. repository: exact repo without a branch
  3. repositoriesMatchingQuery: search string, with the tie breaker being the longer query
  4. The campaign spec changesetTemplate

@LawnGnome LawnGnome added the enhancement New feature or request label Aug 26, 2020
@LawnGnome LawnGnome force-pushed the aharvey/campaign-spec-experiment branch from f3c3385 to 68a5ebc Compare August 26, 2020 23:36
@LawnGnome LawnGnome force-pushed the aharvey/campaign-spec-experiment branch from 68a5ebc to b818ed3 Compare August 27, 2020 01:05
LawnGnome added a commit to sourcegraph/sourcegraph-public-snapshot that referenced this pull request Aug 27, 2020
@LawnGnome
Copy link
Contributor Author

This is the road less taken at this point, and was replaced by #294.

@LawnGnome LawnGnome closed this Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant