get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/134679/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 134679,
    "url": "https://patches.dpdk.org/api/patches/134679/?format=api",
    "web_url": "https://patches.dpdk.org/project/ci/patch/20231128210155.1388785-4-aconole@redhat.com/",
    "project": {
        "id": 5,
        "url": "https://patches.dpdk.org/api/projects/5/?format=api",
        "name": "CI",
        "link_name": "ci",
        "list_id": "ci.dpdk.org",
        "list_email": "ci@dpdk.org",
        "web_url": "",
        "scm_url": "git://dpdk.org/tools/dpdk-ci",
        "webscm_url": "https://git.dpdk.org/tools/dpdk-ci/",
        "list_archive_url": "https://inbox.dpdk.org/ci",
        "list_archive_url_format": "https://inbox.dpdk.org/ci/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231128210155.1388785-4-aconole@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/ci/20231128210155.1388785-4-aconole@redhat.com",
    "date": "2023-11-28T21:01:54",
    "name": "[v3,3/3] github: add a tool for restarting checks",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e392e7a6f347b24bae434892674570f9bc14e2fd",
    "submitter": {
        "id": 332,
        "url": "https://patches.dpdk.org/api/people/332/?format=api",
        "name": "Aaron Conole",
        "email": "aconole@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/ci/patch/20231128210155.1388785-4-aconole@redhat.com/mbox/",
    "series": [
        {
            "id": 30408,
            "url": "https://patches.dpdk.org/api/series/30408/?format=api",
            "web_url": "https://patches.dpdk.org/project/ci/list/?series=30408",
            "date": "2023-11-28T21:01:52",
            "name": "Add a recheck framework to pw-ci",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/30408/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/134679/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/134679/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ci-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 9F48C433FA;\n\tTue, 28 Nov 2023 22:02:03 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4867742E26;\n\tTue, 28 Nov 2023 22:02:03 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id 323B742E16\n for <ci@dpdk.org>; Tue, 28 Nov 2023 22:02:02 +0100 (CET)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-516-ZIC6XNVmNt2edZNUvzVgNw-1; Tue, 28 Nov 2023 16:01:58 -0500",
            "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com\n [10.11.54.2])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0EC50811E8D;\n Tue, 28 Nov 2023 21:01:58 +0000 (UTC)",
            "from RHTPC1VM0NT.lan (unknown [10.22.32.221])\n by smtp.corp.redhat.com (Postfix) with ESMTP id A8B0140C6E83;\n Tue, 28 Nov 2023 21:01:57 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1701205321;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=7EOd/pwjTSOQGd5TenwVC7QzAIKoTMwKg1AXO++jN74=;\n b=eiDswsm4W1hpMEV/aMTl8EQDPW0QCfbAkoVdisuTJX9LNAHuucwc9+3apGGr8xn2+/D6LD\n i42XkKlN7TmXfBHPkVUr5hBvdDBYuMyPF64gdiKOQHRiHRhTmNTVK7bEv+dyUFRxchDFJf\n uXScRqfj4XMdz48DV+Q+Es41CGteKzc=",
        "X-MC-Unique": "ZIC6XNVmNt2edZNUvzVgNw-1",
        "From": "Aaron Conole <aconole@redhat.com>",
        "To": "ci@dpdk.org",
        "Cc": "Michael Santana <msantana@redhat.com>,\n David Marchand <dmarchan@redhat.com>,\n Thomas Monjalon <thomas@monjalon.net>, Patrick Robb <probb@iol.unh.edu>,\n Dumitru Ceara <dceara@redhat.com>",
        "Subject": "[PATCH v3 3/3] github: add a tool for restarting checks",
        "Date": "Tue, 28 Nov 2023 16:01:54 -0500",
        "Message-ID": "<20231128210155.1388785-4-aconole@redhat.com>",
        "In-Reply-To": "<20231128210155.1388785-1-aconole@redhat.com>",
        "References": "<20231128210155.1388785-1-aconole@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.2",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-BeenThere": "ci@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK CI discussions <ci.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/ci>,\n <mailto:ci-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/ci/>",
        "List-Post": "<mailto:ci@dpdk.org>",
        "List-Help": "<mailto:ci-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/ci>,\n <mailto:ci-request@dpdk.org?subject=subscribe>",
        "Errors-To": "ci-bounces@dpdk.org"
    },
    "content": "The recheck framework can track specific recheck labels and track a\nstate for them.  Add a tool that will restart github workflow runs\nand mark the git build table to check for a repoll.  This will allow\nexisting monitor tools to re-poll the workflow and report rerun\nresults.\n\nAcked-by: Michael Santana <msantana@redhat.com>\nSigned-off-by: Aaron Conole <aconole@redhat.com>\n---\n github_restart   | 145 +++++++++++++++++++++++++++++++++++++++++++++++\n series_db_lib.sh |   8 +++\n 2 files changed, 153 insertions(+)\n create mode 100755 github_restart",
    "diff": "diff --git a/github_restart b/github_restart\nnew file mode 100755\nindex 0000000..d5d63b9\n--- /dev/null\n+++ b/github_restart\n@@ -0,0 +1,145 @@\n+#!/bin/bash\n+# SPDX-Identifier: gpl-2.0-or-later\n+# Copyright (C) 2023, Red Hat, Inc.\n+#\n+# Restarts a github job run.  This can be used in conjunction with\n+# the recheck requests to provide the ability for a user to restart\n+# a test - in case the workflow is suspected of having a spurious run.\n+#\n+# Licensed under the terms of the GNU General Public License as published\n+# by the Free Software Foundation; either version 2 of the License, or\n+# (at your option) any later version.  You may obtain a copy of the\n+# license at\n+#\n+#    https://www.gnu.org/licenses/old-licenses/gpl-2.0.html\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+# License for the specific language governing permissions and limitations\n+# under the License.\n+\n+wait_start=\"no\"\n+\n+while [ \"$1\" != \"\" ]; do\n+    if echo \"$1\" | grep -q -s -E ^--pw-project= ; then\n+        pw_project=$(echo \"$1\" | sed s/^--pw-project=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--pw-instance= ; then\n+        pw_instance=$(echo \"$1\" | sed s/^--pw-instance=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--pw-credentials= ; then\n+        pw_credential=$(echo \"$1\" | sed s/^--pw-credentials=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--series-id= ; then\n+        series_id=$(echo \"$1\" | sed s/^--series-id=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--wait-start ; then\n+        wait_start=\"yes\"\n+        if echo \"$1\" | grep -q -s -E ^--wait-start= ; then\n+            wait_start=$(echo \"$1\" | sed s/^--wait-start=//)\n+        fi\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--github-token= ; then\n+        github_token=$(echo \"$1\" | sed s/^--github-token=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--repository= ; then\n+        reponame=$(echo \"$1\" | sed s/^--repository=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--run-id= ; then\n+        runid=$(echo \"$1\" | sed s/^--repository=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--sha= ; then\n+        sha=$(echo \"$1\" | sed s/^--sha=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--workflow= ; then\n+        workflow=$(echo \"$1\" | sed s/^--workflow=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--help ; then\n+        echo \"github restarting script\"\n+        echo \"$0: args\"\n+        echo \"  --pw-project=<proj>\t\tProject name\"\n+        echo \"  --pw-instance=<inst url>\tURL for pw\"\n+        echo \"  --series-id=id\t\tSeries ID for reference\"\n+        echo \"  --github-token=token\t\tToken for github\"\n+        echo \"  --wait-start[=yes|no]\t\tWait for the remote to start\"\n+        echo \"  --repository=repo\t\tRepository name (ex foo/bar)\"\n+        echo \"  --run-id=id\t\t\trun ID\"\n+        echo \"  --workflow=workflow\t\tWorkflow name\"\n+        echo \"  --sha=commit\t\t\tCommit sha\"\n+        echo \"\"\n+        exit 0\n+    else\n+        echo \"Unknown option: '$1'\" >&2\n+        echo \"Rerun with --help for details\" >&2\n+        exit 1\n+    fi\n+done\n+\n+source $(dirname $0)/series_db_lib.sh\n+\n+if [ \"X$wait_start\" != \"Xno\" -a \"X$wait_start\" != \"Xyes\" ]; then\n+    echo \"Unrecognized '$wait_start' argument to --wait-start=\" >&2\n+    echo \"valid values are 'yes' or 'no'.\" >&2\n+    exit 1\n+fi\n+\n+if [ \"X$github_token\" == \"X\" ]; then\n+    echo \"Please set a github API token.\" >&2\n+    echo \"Use --help for more info.\" >&2\n+    exit 1\n+fi\n+\n+if [ \"X$reponame\" == \"X\" ]; then\n+    echo \"Please set a repository (ie: '--repository=owner/repo').\" >&2\n+    echo \"Use --help for more info.\" >&2\n+    exit 1\n+fi\n+\n+AUTH=\"Authorization: token ${github_token}\"\n+APP=\"Accept: application/vnd.github.v3+json\"\n+\n+if [ \"X$runid\" == \"X\" ]; then\n+\n+    # lookup the runs based on the shasum\n+\n+    if [ \"X$sha\" == \"X\" ]; then\n+        echo \"Need a runid or shasum to key off.\" >&2\n+        echo \"See --help for more details.\" >&2\n+        exit 1\n+    fi\n+\n+    if [ \"X$workflow\" != \"X\" ]; then\n+        workflow_select=\" | select(.name == \\\"${workflow}\\\")\"\n+    fi\n+\n+    comma=\"\"\n+    for job in $(curl -s -S -H \"${AUTH}\" -H \"${APP}\" \\\n+                      \"https://api.github.com/repos/${reponame}/actions/runs?head_sha=${sha}\" | \\\n+                     jq -rc \".workflow_runs[] ${workflow_select} .id\")\n+    do\n+        runid=\"${comma}${job}\"\n+        comma=\",\"\n+    done\n+fi\n+\n+echo -n \"{\\\"results\\\":[\"\n+comma=\"\"\n+for job in $(echo \"$runid\" | sed 's/,/ /'); do\n+    result=$(curl -s -X POST -L -S -H \"${AUTH}\" -H \"${APP}\" \\\n+                  \"https://api.github.com/repos/${reponame}/actions/runs/$job/rerun\")\n+    msg=$(echo \"$result\" | jq -rc '.message')\n+\n+    echo -n \"$comma{\\\"run\\\":$job,\\\"result\\\":\"\n+    if [ \"X$msg\" == \"Xnull\" ]; then\n+        echo -n \"\\\"sent\\\"\"\n+        if [ \"X$series_id\" != \"X\" ]; then\n+            echo -n \",\\\"gap_sync\\\":\\\"reset\\\"\"\n+            set_unsynced_for_series \"$series_id\" \"$pw_instance\" \"gap_sync\"\n+        fi\n+    else\n+        echo -n \"\\\"err\\\",\\\"error\\\":\\\"$msg\\\"\"\n+    fi\n+    echo -n \"}\"\n+done\n+echo \"]}\"\ndiff --git a/series_db_lib.sh b/series_db_lib.sh\nindex e03a02e..3f052ad 100644\n--- a/series_db_lib.sh\n+++ b/series_db_lib.sh\n@@ -382,6 +382,14 @@ function set_synced_for_series() {\n     echo \"update git_builds set gap_sync=1, obs_sync=1 where patchwork_instance=\\\"$instance\\\" and series_id=$series_id;\" | series_db_execute\n }\n \n+function set_unsynced_for_series() {\n+    local series_id=\"$1\"\n+    local instance=\"$2\"\n+    local ci_instance=\"$3\"\n+\n+    echo \"update git_builds set $ci_instance=0 where patchwork_instance=\\\"$instance\\\" and series_id=$series_id;\" | series_db_execute\n+}\n+\n function insert_commit() {\n     local series_id=\"$1\"\n     local patch_id=\"$2\"\n",
    "prefixes": [
        "v3",
        "3/3"
    ]
}