File: Commit.rst

package info (click to toggle)
pygithub 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,476 kB
  • sloc: python: 38,409; sh: 7; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 672 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Commit
======

Create commit status check
--------------------------

.. code-block:: python

    # sha -> commit on which the status check will be created
    # For example, for a webhook payload
    # sha = data["pull_request"]["head"]["sha"]
    repo.get_commit(sha=sha).create_status(
        state="pending",
        target_url="https://FooCI.com",
        description="FooCI is building",
        context="ci/FooCI"
    )

Get commit date
--------------------------

.. code-block:: python

    >>> commit = repo.get_commit(sha=sha)
    >>> print(commit.commit.author.date)
    2018-10-11 03:04:52
    >>> print(commit.commit.committer.date)
    2018-10-11 03:04:52