get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 133951,
    "url": "https://patches.dpdk.org/api/patches/133951/?format=api",
    "web_url": "https://patches.dpdk.org/project/ci/patch/20231107203158.1261199-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": "<20231107203158.1261199-4-aconole@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/ci/20231107203158.1261199-4-aconole@redhat.com",
    "date": "2023-11-07T20:31:58",
    "name": "[RFC,v2,3/3] github: add a tool for restarting checks",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "039d8d51598e4066fcc3f347b6f6ab04d85f1eb7",
    "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/20231107203158.1261199-4-aconole@redhat.com/mbox/",
    "series": [
        {
            "id": 30191,
            "url": "https://patches.dpdk.org/api/series/30191/?format=api",
            "web_url": "https://patches.dpdk.org/project/ci/list/?series=30191",
            "date": "2023-11-07T20:31:55",
            "name": "Add a recheck framework to pw-ci",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/30191/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/133951/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/133951/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 17D60432CA;\n\tTue,  7 Nov 2023 21:32:04 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 11FFC40698;\n\tTue,  7 Nov 2023 21:32:04 +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 CAD674025E\n for <ci@dpdk.org>; Tue,  7 Nov 2023 21:32:02 +0100 (CET)",
            "from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73])\n by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-l6ilWbjAN2uEKLdlR1ss4w-1; Tue,\n 07 Nov 2023 15:32:00 -0500",
            "from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com\n [10.11.54.5])\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 C81BE2810D41;\n Tue,  7 Nov 2023 20:31:59 +0000 (UTC)",
            "from RHTPC1VM0NT.redhat.com (unknown [10.22.33.168])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 947A419E93;\n Tue,  7 Nov 2023 20:31:59 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1699389122;\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=Gykds1XSdqvJ2Oye6cSilZN506KLY6/+NXz51yROpZg=;\n b=LOTXeczHYNLmVWQ/EX5ApZSDle5xf3i7T/LdsWp1E4G4dLnadpr/QoNBQzBm/lNEyvnDa3\n gXLcXpnXSC6lG381KwSNtRhhiCDVFr5a/8x9EzzhL1AaGo/qzDKqa+zWDPzyJ/d61Fc5L/\n 3qi2egOjfzd+pxwAonSQGVjyv9KItD0=",
        "X-MC-Unique": "l6ilWbjAN2uEKLdlR1ss4w-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": "[RFC v2 3/3] github: add a tool for restarting checks",
        "Date": "Tue,  7 Nov 2023 15:31:58 -0500",
        "Message-ID": "<20231107203158.1261199-4-aconole@redhat.com>",
        "In-Reply-To": "<20231107203158.1261199-1-aconole@redhat.com>",
        "References": "<20231107203158.1261199-1-aconole@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.5",
        "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\nSigned-off-by: Aaron Conole <aconole@redhat.com>\n---\n github_restart   | 141 +++++++++++++++++++++++++++++++++++++++++++++++\n series_db_lib.sh |  16 ++++++\n 2 files changed, 157 insertions(+)\n create mode 100755 github_restart",
    "diff": "diff --git a/github_restart b/github_restart\nnew file mode 100755\nindex 0000000..5ba9677\n--- /dev/null\n+++ b/github_restart\n@@ -0,0 +1,141 @@\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+    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[].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 ca33c1f..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@@ -407,6 +415,14 @@ function get_patch_id_by_series_id_and_sha() {\n     echo \"select patch_id from git_builds where patchwork_instance=\\\"$instance\\\" and series_id=$series_id and sha=\\\"$sha\\\";\" | series_db_execute\n }\n \n+function get_sha_for_series_id_and_patch() {\n+    local series_id=\"$1\"\n+    local patch_id=\"$2\"\n+    local instance=\"$3\"\n+\n+    echo \"select sha from git_builds where patchwork_instance=\\\"$instance\\\" and series_id=\\\"$series_id\\\" and patch_id=\\\"$patch_id\\\"\" | series_db_execute\n+}\n+\n function get_recheck_requests_by_project() {\n     local recheck_instance=\"$1\"\n     local recheck_project=\"$2\"\n",
    "prefixes": [
        "RFC",
        "v2",
        "3/3"
    ]
}