Skip to content

Allow addressing changesets by branch

Warren Gifford requested to merge mrn/branch-addressing into main

Created by: mrnugget

This uses https://github.com/sourcegraph/campaignutils/pull/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

Merge request reports

Loading