Skip to content
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

Allow addressing changesets by branch #461

Merged
merged 6 commits into from
Feb 9, 2021
Merged

Conversation

mrnugget
Copy link
Contributor

@mrnugget mrnugget commented Feb 5, 2021

This uses sourcegraph/batch-change-utils#9 to extend the pattern syntax for the published field in the changesetTemplate to allow addressing specific changesets in a repository by their branch name.

Example:

name: branch-addressing
description: Addressing a single changeset by branch name

on:
  - repository: github.com/sourcegraph/automation-testing

workspaces:
  - rootAtLocationOf: package.json
    in: github.com/sourcegraph/automation-testing

steps:
  - run: |
      echo "We are in $(basename $(pwd))" >> message.txt &&
      basename $(pwd)
    container: alpine:3
    outputs:
      directoryName:
        value: ${{ step.stdout }}

changesetTemplate:
  title: Branch addressing
  body: Addressing a single changeset by branch name
  commit:
    message: Branch addressing
  branch: thorsten/branch-addressing-${{ outputs.directoryName }}
  published:
    - github.com/sourcegraph/automation-*@thorsten/branch-addressing-project1: draft

The campaign spec produces 3 changesets in 3 different branches of automation-testing, but only the changeset on the thorsten/branch-addressing-project1 is published as a draft:

image

go.mod Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
mrnugget and others added 2 commits February 9, 2021 11:33
Co-authored-by: Adam Harvey <aharvey@sourcegraph.com>
@mrnugget mrnugget merged commit b192404 into main Feb 9, 2021
@mrnugget mrnugget deleted the mrn/branch-addressing branch February 9, 2021 10:46
scjohns pushed a commit that referenced this pull request Apr 24, 2023
* Allow addressing changesets by branch

* Use fork instead of local copy

* Add tests to make sure addressing by branch works

* Add changelog entry

* Update CHANGELOG.md

Co-authored-by: Adam Harvey <aharvey@sourcegraph.com>

* Update to merged campaignutils version

Co-authored-by: Adam Harvey <aharvey@sourcegraph.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants