Code Monkey home page Code Monkey logo

gram-cli's Introduction

Github Repo Automater

gram is a cli to help automate common repository tasks.

Usage

See the cli help for more information.

gram 0.1.0
Supported commands

USAGE:
    gram --token <token> <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -t, --token <token>    Github token to use [env: GITHUB_TOKEN=]

SUBCOMMANDS:
    help        Prints this message or the help of the given subcommand(s)
    settings    Interactions for repository settings

gram-cli's People

Contributors

wayofthepie avatar

Stargazers

Merritt Krakowitzer avatar

Watchers

James Cloos avatar  avatar  avatar mck-kwilk avatar

gram-cli's Issues

Support diff for branch protection settings

We should minimally support:

  • Check the branches with protection #23
  • Require pull request reviews before merging (including the number of required approvers)
    • Require review from Code Owners
  • Require status checks to pass before merging
    • Require branches to be up to date before merging (allow taking a list of status checks required)

Diff: Check the branches with protection

$ curl -s -u"${TOKEN}:" https://api.github.com/repos/wayofthepie/gram-cli/branches?protected=true
[
  {
    "name": "master",
    "commit": {
      "sha": "5c377b4509b894712f8c6cbfd82e58bc34a37889",
      "url": "https://api.github.com/repos/wayofthepie/gram-cli/commits/5c377b4509b894712f8c6cbfd82e58bc34a37889"
    },
    "protected": true,
    "protection": {
      "enabled": true,
      "required_status_checks": {
        "enforcement_level": "non_admins",
        "contexts": [
          "ci",
          "clippy"
        ]
      }
    },
    "protection_url": "https://api.github.com/repos/wayofthepie/gram-cli/branches/master/protection"
  }
]

Fix docs

There are some discrepancies in the docs, most importantly the ones structopt embeds in the cli.

Be careful about what gets into structopt docs

/// Supported commands and options.
///
/// # Diff settings
/// `gram` supports diffing known settings defined in a settings toml file
/// against the current repository settings.
#[derive(Debug, StructOpt)]
#[structopt(name = "gram")]
pub struct GramOpt {

Need to be careful what docs get placed into structopt. The above is incorrect as when gram is run it looks like this:
image

Incorrect settings help

static SETTINGS_HELP: &str = concat!(
"Path to the settings file",
r#"
This is a toml file. For example:
-----------------------------------------
description = "This is a test repository"
[settings]
merge.allow-squash = false
-----------------------------------------
"#
);

This is outdated. It might be possible to try parse the settings here somehow with doc-tests, not exactly as is, but it would be worth doing if possible.

Improve error when settings file is a non-existant path

Currently if the path to the settings file does not exist an error will be thrown that could really be better:

$ gram diff-settings -o wayofthepie -r gh-app-test -s non_existent_file
Error: No such file or directory (os error 2)

We should at least mention the file that was passed:

Error: No such file or directory non_existent_file

The code is here:

let settings_str = self.read_to_string(settings_location)?;

Support for initial Options settings

Most of the repos I deal with have the following configuration from the Options menu:

  • Allow merge disabled
  • Allow squash disabled
  • Allow rebase enabled
  • Auto delete head branches enabled

So support for the above should be added initially. Along with support for two general settings - topics and description.

Add support

  • Description
  • Options -> Allow merge commit
  • Options -> Allow squash merge
  • Options -> Allow rebase merge
  • Topics (will look at this one another time, not very important yet)

Add security audit action

Other repos I have that are rust have a security audit action. For example see the dockerfile-parser-rs security audit action.

name: security audit
on:
  schedule:
    - cron: "0 8 * * *"
  push:
    paths:
      - "Cargo.*"
  pull_request:
    branches:
      - master
jobs:
  security_audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions-rs/audit-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.