How to use the ghstack.config.read_config function in ghstack

To help you get started, we’ve selected a few ghstack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ezyang / ghstack / ghstack / __main__.py View on Github external
status.add_argument('pull_request', metavar='PR',
        help='GitHub pull request URL to perform action on')

    args = parser.parse_args()

    if args.version:
        print("ghstack {}".format(ghstack.__version__))
        return

    if args.cmd is None:
        args.cmd = 'submit'

    with ghstack.logging.manager(debug=args.debug):

        sh = ghstack.shell.Shell()
        conf = ghstack.config.read_config()
        ghstack.logging.formatter.redact(conf.github_oauth, '')
        github = ghstack.github_real.RealGitHubEndpoint(
            oauth_token=conf.github_oauth,
            proxy=conf.proxy
        )

        if args.cmd == 'rage':
            ghstack.rage.main(latest=args.latest)
        elif args.cmd == 'submit':
            ghstack.submit.main(
                msg=args.message,
                username=conf.github_username,
                sh=sh,
                github=github,
                update_fields=args.update_fields,
                short=args.short,
github ezyang / ghstack / ghstack / __main__.py View on Github external
pull_request=args.pull_request,
                github=github,
                sh=sh,
            )
        elif args.cmd == 'action':
            ghstack.action.main(
                pull_request=args.pull_request,
                github=github,
                sh=sh,
                close=args.close,
            )
        elif args.cmd == 'status':
            # Re-read conf and request circle token if not available
            # TODO: Restructure this so that we just request
            # configurations "on-demand" rather than all upfront
            conf = ghstack.config.read_config(request_circle_token=True)
            if conf.circle_token:
                ghstack.logging.formatter.redact(conf.circle_token, '')
            circleci = ghstack.circleci_real.RealCircleCIEndpoint(
                circle_token=conf.circle_token
            )
            # Blegh
            loop = asyncio.get_event_loop()
            loop.run_until_complete(ghstack.status.main(
                pull_request=args.pull_request,
                github=github,
                circleci=circleci
            ))
            loop.close()
        elif args.cmd == 'checkout':
            ghstack.checkout.main(pull_request=args.pull_request, github=github, sh=sh)
        else: