Пример #1
0
    def check_pr_title():
        remote = git(["config", "--get", f"remote.{args.remote}.url"])
        user, repo = parse_remote(remote)

        if args.pr_title:
            title = args.pr_title
        else:
            github = GitHubRepo(token=os.environ["TOKEN"],
                                user=user,
                                repo=repo)
            pr = github.get(f"pulls/{args.pr}")
            title = pr["title"]
        print("pr title:", title)
        return title.startswith("[skip ci]")
Пример #2
0
    def check_pr_title():
        remote = git(["config", "--get", f"remote.{args.remote}.url"])
        user, repo = parse_remote(remote)

        if args.pr_title:
            title = args.pr_title
        else:
            github = GitHubRepo(token=os.environ["TOKEN"],
                                user=user,
                                repo=repo)
            pr = github.get(f"pulls/{args.pr}")
            title = pr["title"]
        logging.info(f"pr title: {title}")
        tags = tags_from_title(title)
        logging.info(f"Found title tags: {tags}")
        return "skip ci" in tags
Пример #3
0
                        default=0,
                        type=int,
                        help="ssh remote to parse")
    parser.add_argument("--dry-run",
                        action="store_true",
                        help="don't update GitHub")
    parser.add_argument("--allowlist", help="filter by these PR authors")
    parser.add_argument(
        "--pr-json",
        help="(testing) data for testing to use instead of GitHub")
    parser.add_argument("--now",
                        help="(testing) custom string for current time")
    args = parser.parse_args()

    remote = git(["config", "--get", f"remote.{args.remote}.url"])
    user, repo = parse_remote(remote)

    wait_time = datetime.timedelta(minutes=int(args.wait_time_minutes))
    cutoff_pr_number = int(args.cutoff_pr_number)
    print(
        "Running with:\n"
        f"  time cutoff: {wait_time}\n"
        f"  number cutoff: {cutoff_pr_number}\n"
        f"  dry run: {args.dry_run}\n"
        f"  user/repo: {user}/{repo}\n",
        end="",
    )

    # [slow rollout]
    # This code is here to gate this feature to a limited set of people before
    # deploying it for everyone to avoid spamming in the case of bugs or