Posts results to a commit status in GitHub if this build is for a pull request.
342751
def post_commit_status(self):
        
        if self.violations:
            plural = '' if self.introduced_issues_count == 1 else 's'
            description = 'Pull Request introduced {} linting violation{}'.format(
                self.introduced_issues_count, plural)
            self._post_status('failure', description)
        else:
            self._post_status('success', 'Linting detected no new issues.')
622034
def publish(self):
        '''
        
        '''

        self.cleanup

        remote = self.remote
        branch = self.branch
        return self.m(
            'pushing changes to %s/%s' % (remote, branch),
            cmdd=dict(
                cmd='git push -u %s %s' % (remote, branch),
                cwd=self.local
            ),
            more=dict(remote=remote, branch=branch)
        )
625793
def commit_in_valid_branch?
      # If two refs are entirely different commit histories, the API responds
      # with a 404. Rescue Octokit::NotFound in this case.
      begin
        default_compare = @client.compare @repo[:full_name],
          @repo[:default_branch], @commit[:sha]
      rescue Octokit::NotFound
        default_compare = nil
      end

      # The compare status should be "identical" or "behind" if the commit is in
      # the default branch
      if default_compare.nil? ||
        !(%w(identical behind).include?(default_compare[:status]))

        # If the commit is not in the default branch, check the gh-pages branch
        begin
          gh_pages_compare = @client.compare @repo[:full_name], "gh-pages",
            @commit[:sha]
        rescue Octokit::NotFound
          gh_pages_compare = nil
        end
        return false if !gh_pages_compare
        return false if !%w(identical behind).include? gh_pages_compare [:status]
      end

      true
    end
604555
def get_result(self, commit, default=MemoteResult()):
        """"""
        assert self._results is not None, \
            "Please call the method `load_history` first."
        return self._results.get(commit, default)
561918
def runs_done():
    """"""
    build = g.build
    release_name, release_number = _get_release_params()

    release = (
        models.Release.query
        .filter_by(build_id=build.id, name=release_name, number=release_number)
        .with_lockmode('update')
        .first())
    utils.jsonify_assert(release, 'Release does not exist')

    release.status = models.Release.PROCESSING
    db.session.add(release)
    _check_release_done_processing(release)
    db.session.commit()

    signals.release_updated_via_api.send(app, build=build, release=release)

    logging.info('Runs done for release: build_id=%r, release_name=%r, '
                 'release_number=%d', build.id, release.name, release.number)

    results_url = url_for(
        'view_release',
        id=build.id,
        name=release.name,
        number=release.number,
        _external=True)

    return flask.jsonify(
        success=True,
        results_url=results_url)
306941
void commitStatus(Runnable closure) {
        GhprbSimpleStatusContext context = new GhprbSimpleStatusContext();
        ContextExtensionPoint.executeInContext(closure, context);

        extensions.add(new GhprbSimpleStatus(
                context.showMatrixStatus,
                context.context,
                context.statusUrl,
                context.triggeredStatus,
                context.startedStatus,
                context.addTestResults,
                context.completedStatus
        ));
    }
391326
def check_conflict()
      check_results = []

      repo_name = github.pr_json[:base][:repo][:full_name]

      pull_requests = github.api.pull_requests(repo_name).select do |pr|
        pr[:id] != github.pr_json[:id] && pr[:base][:label] == github.pr_json[:base][:label]
      end

      return check_results if pull_requests.empty?

      g = Git.open(Dir.pwd)

      pull_requests.each do |pr|
        result = {
          pull_request: pr,
          mergeable: true,
          conflicts: []
        }

        uuid = SecureRandom.uuid

        r = g.add_remote(uuid, pr[:head][:repo][:ssh_url])
        r.fetch()

        branch1 = github.pr_json[:head][:ref]
        branch2 = "#{uuid}/#{pr[:head][:ref]}"

        base = `git merge-base #{branch1} #{branch2}`.chomp

        Tempfile.open('tmp') do |f|
          patch = `git format-patch #{base}..#{branch2} --stdout`.chomp
          f.sync = true
          f.puts patch
          out, s = Open3.capture2e("git apply --check #{f.path}")

          out.each_line do |line|

            if 'patch failed' == line.split(':')[1].strip
              conflict = {
                file: line.split(':')[2].strip,
                line: line.split(':')[3].strip.to_i
              }
              result[:conflicts] << conflict
            end
          end

          result[:mergeable] = result[:conflicts].empty?
        end

        g.remove_remote(uuid)

        check_results << result
      end

      check_results
    end
1312464
def get_stats_commit_activity(self):
        
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/stats/commit_activity"
        )
        if not data:
            return None
        else:
            return [
                github.StatsCommitActivity.StatsCommitActivity(self._requester, headers, attributes, completed=True)
                for attributes in data
            ]
1295723
def as_pull_request(self):
        
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            "/pulls/".join(self.url.rsplit("/issues/", 1))
        )
        return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
654015
def commit_pending?(path)
      status = ""
      Dir.chdir(path) do
        status = `git status 2>/dev/null`
      end
      return status.include?("Changes to be committed") || status.include?("Changes not staged for commit")
    end
554558
def get_commit(self, sha):
        
        assert isinstance(sha, (str, unicode)), sha
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/commits/" + sha
        )
        return github.Commit.Commit(self._requester, headers, data, completed=True)
505800
def status(self):
        
        orig_dict = self._get(self._service_url('status'))
        orig_dict['implementation_version'] = orig_dict.pop('Implementation-Version')
        orig_dict['built_from_git_sha1'] = orig_dict.pop('Built-From-Git-SHA1')
        return Status(orig_dict)
933015
public List<GitlabCommitStatus> getCommitStatuses(GitlabProject project, String commitHash) throws IOException {
        return getCommitStatuses(project.getId(), commitHash, new Pagination());
    }
1044573
def _get_commit_msg(self, repo, sha):
        '''
        
        '''
        headers = {
            'User-Agent': 'Buildbot'
        }
        if self._token:
            headers['Authorization'] = 'token ' + self._token

        url = '/repos/{}/commits/{}'.format(repo, sha)
        http = yield httpclientservice.HTTPClientService.getService(
            self.master, self.github_api_endpoint, headers=headers,
            debug=self.debug, verify=self.verify)
        res = yield http.get(url)
        data = yield res.json()
        msg = data.get('commit', {'message': 'No message field'})['message']
        return msg
414941
def _get_pull_requests(self):
        
        for pull in self.repo.pull_requests(
            state="closed", base=self.github_info["master_branch"], direction="asc"
        ):
            if self._include_pull_request(pull):
                yield pull
28097
def get_statuses(self):
        
        return github.PaginatedList.PaginatedList(
            github.CommitStatus.CommitStatus,
            self._requester,
            self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha,
            None
        )
364236
def status(context):
    """"""
    context.obj.find_repo_type()
    context.obj.call([context.obj.vc_name, 'status'])