All Projects β†’ jelmer β†’ silver-platter

jelmer / silver-platter

Licence: GPL-2.0 license
Automate the creation of merge proposals for scriptable changes

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to silver-platter

vet
Gerrit client using pull request workflow
Stars: ✭ 21 (+10.53%)
Mutual labels:  pull-request, pull-requests
Github Issue Templates
πŸ”£ A collection of GitHub issue and pull request templates
Stars: ✭ 3,074 (+16078.95%)
Mutual labels:  pull-request, pull-requests
action-pr-title
Github action to enforce Pull Request title conventions
Stars: ✭ 83 (+336.84%)
Mutual labels:  pull-request, pull-requests
pull-request-size
Applies labels to Pull Requests based on the total lines of code changed.
Stars: ✭ 98 (+415.79%)
Mutual labels:  pull-requests
libvcs
βš™οΈ Lite, typed, pythonic utilities for git, svn, mercurial, etc.
Stars: ✭ 43 (+126.32%)
Mutual labels:  vcs
koshry
Run on CI, Apply Rules on the Build and Get the Result back to the Pull Request.
Stars: ✭ 59 (+210.53%)
Mutual labels:  pull-request
gitarena
Software development platform with built-in vcs, issue tracking and code review
Stars: ✭ 26 (+36.84%)
Mutual labels:  vcs
hacktoberfest-2019
You can check the video here: #hacktoberfest
Stars: ✭ 28 (+47.37%)
Mutual labels:  pull-requests
HacktoberFest2021
Dedicated to hactoberFest2021
Stars: ✭ 30 (+57.89%)
Mutual labels:  pull-requests
VBA-Import-Export
Export & Import VBA code for use with Git (or any VCS)
Stars: ✭ 14 (-26.32%)
Mutual labels:  vcs
Poke-Dex
This is a small webpage that allows user to add their favourite PokΓ©mons! This project aims to help people in creating their first pull requests and participating in Hacktoberfest 2021
Stars: ✭ 126 (+563.16%)
Mutual labels:  pull-request
action-semantic-pull-request
A GitHub Action that ensures that your PR title matches the Conventional Commits spec.
Stars: ✭ 377 (+1884.21%)
Mutual labels:  pull-requests
lobicornis
πŸ€– [Myrmica Lobicornis 🐜] Bot: Update and Merge Pull Request
Stars: ✭ 27 (+42.11%)
Mutual labels:  pull-requests
github-rebase-bot
A github bot that monitors repository PRs, rebases them and merges them as they pass tests
Stars: ✭ 29 (+52.63%)
Mutual labels:  pull-requests
label-actions
πŸ€– GitHub Action that performs certain tasks when issues, pull requests or discussions are labeled or unlabeled
Stars: ✭ 60 (+215.79%)
Mutual labels:  pull-request
critiq.vim
Github code reviews from Neovim
Stars: ✭ 69 (+263.16%)
Mutual labels:  pull-requests
pr-reviews-reminder-action
A GitHub Action to send Slack/Teams notification for Pull Request that are waiting for reviewers.
Stars: ✭ 18 (-5.26%)
Mutual labels:  pull-requests
hacktoberfest
Fork and Create a Pull Request
Stars: ✭ 13 (-31.58%)
Mutual labels:  pull-requests
nrwl-nx-action
A GitHub Action to wrap Nrwl Nx commands in your workflows.
Stars: ✭ 163 (+757.89%)
Mutual labels:  pull-request
Repo-Excluded-From-HacktoberFest-2021
Know a bit of python & need pr for hacktoberfest ? come join us in the journey
Stars: ✭ 17 (-10.53%)
Mutual labels:  pull-requests

Silver-Platter

Silver-Platter makes it possible to contribute automatable changes to source code in a version control system ("codemods" <https://github.com/jelmer/awesome-codemods>`_).

It automatically creates a local checkout of a remote repository, makes user-specified changes, publishes those changes on the remote hosting site and then creates a pull request.

In addition to that, it can also perform basic maintenance on branches that have been proposed for merging - such as restarting them if they have conflicts due to upstream changes.

Silver-Platter powers the Debian Janitor (https://janitor.debian.org/) and Kali Janitor (https://kali.janitor.org/). However, it is an independent project and can be used fine as a standalone tool. The UI is still a bit rough around the edges, I'd be grateful for any feedback from people using it - please file bugs in the issue tracker at https://github.com/jelmer/silver-platter/issues/new.

Getting started

To log in to a code-hosting site, use svp login:

svp login https://github.com/

The simplest way to create a change as a merge proposal is to run something like:

svp run --mode=propose ./framwork.sh https://github.com/jelmer/dulwich

where framwork.sh makes some modifications to a working copy and prints the commit message and body for the pull request to standard out. For example:

#!/bin/sh
sed -i 's/framwork/framework/' README.rst
echo "Fix common typo: framwork => framework"

If you leave pending changes, silver-platter will automatically create a commit and use the output from the script as the commit message. Scripts also create their own commits if they prefer - this is especially useful if they would like to create multiple commits.

Recipes

To make this process a little bit easier to repeat, recipe files can be used. For the example above, we could create a framwork.yaml with the following contents:

---
name: framwork
command: ./framwork.sh
mode: propose
merge-request:
  commit-message: Fix a typo
  description:
    markdown: |-
      I spotted that we often mistype *framework* as *framwork*.

To execute this recipe, run:

svp run --recipe=framwork.yaml https://github.com/jelmer/dulwich

See example.yaml for an example recipe with plenty of comments.

In addition, you can run a particular recipe over a set of repositories by specifying a candidate list. For example, if candidates.yaml looked like this:

---
- url: https://github.com/dulwich/dulwich
- url: https://github.com/jelmer/xandikos

then the following command would process each repository in turn:

svp run --recipe=framwork.yaml --candidates=candidates.yaml

Supported hosters

At the moment, the following code hosters are supported:

Working with Debian packages

Several common operations for Debian packages have dedicated subcommands under the debian-svp command. These will also automatically look up packaging repository location for any Debian package names that are specified.

  • upload-pending: Build and upload a package and push/propose the changelog updates.
  • run: Similar to svp run but specific to Debian packages: it ensures that the upstream and pristine-tar branches are available as well, can optionally update the changelog, and can test that the branch still builds.

Some Debian-specific example recipes are provided in examples/debian/:

  • lintian-fixes.yaml: Run the lintian-brush command to fix common issues reported by lintian.
  • new-upstream-release.yaml: Merge in a new upstream release.
  • multi-arch-hints.yaml: Apply multi-arch hints.
  • orphan.yaml: Mark a package as orphaned, update its Maintainer field and move it to the common Debian salsa group.
  • rules-requires-root.yaml: Mark a package as "Rules-Requires-Root: no"
  • cme.yaml: Run "cme fix dpkg", from the cme package.

debian-svp run takes package name arguments that will be resolved to repository locations from the Vcs-Git field in the package.

See debian-svp COMMAND --help for more details.

Examples running debian-svp:

# Create merge proposal running lintian-brush against Samba
debian-svp run --recipe=examples/lintian-brush.yaml samba

# Upload pending changes for tdb
debian-svp upload-pending tdb

# Upload pending changes for any packages maintained by Jelmer,
# querying vcswatch.
debian-svp upload-pending --vcswatch --maintainer [email protected]

# Import the latest upstream release for tdb, without testing
# the build afterwards.
debian-svp run --recipe=examples/debian/new-upstream-release.yaml \
    --no-build-verify tdb

# Apply multi-arch hints to tdb
debian-svp run --recipe=examples/debian/multiarch-hints.yaml tdb

The following environment variables are provided for Debian packages:

  • DEB_SOURCE: the source package name
  • DEB_UPDATE_CHANGELOG: indicates whether a changelog entry should be added. Either "leave" (leave alone) or "update" (update changelog).

Credentials

The svp hosters subcommand can be used to display the hosting sites that silver-platter is aware of:

svp hosters

And to log into a new hosting site, simply run svp login BASE-URL, e.g.:

svp login https://launchpad.net/

Exit status

svp run will exit 0 if no changes have been made, 1 if at least one repository has been changed and 2 in case of trouble.

Python API

Other than the command-line API, silver-platter also has a Python API. The core class is the Workspace context manager, which exists in two forms:

  • silver_platter.workspace.Workspace (for generic projects)
  • silver_platter.debian.Workspace (for Debian packages)

An example, adding a new entry to a changelog file in the dulwich Debian package and creating a merge proposal with that change:

from silver_platter.debian import Workspace
import subprocess

with Workspace.from_apt_package(package="dulwich") as ws:
    subprocess.check_call(['dch', 'some change'], cwd=ws.path)
    ws.commit()  # Behaves like debcommit
    ws.publish(mode='propose')
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].