Rest endpoint to delete comments returning 404

オープン
#435 コメント 0 件 リアクション 6 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
github, github-actions, javascript
領域
api, ci-cd

調査の方向性

Start with the workflow snippet in the issue and the linked GitHub REST documentation for deleting an issue comment. Compare the comment identifiers saved by gh pr view --json comments with the comment_id passed to github.rest.issues.deleteComment, then verify the documented request against the reported 404 response. Done means the conditional deletion works for the saved comments.

索引モデルが issue の本文から書いたものです。

説明

I am saving the output of a gh cli invocation as follows:

gh pr view ${{ github.event.number }} --json comments > comments.json

I then want to iterate on the saved comments and conditionally delete some of them,

      - name: delete comments
        uses: actions/github-script@v6
        with:
          result-encoding: string
          script: |
            const fs = require('fs');
            const jsonData = JSON.parse(fs.readFileSync('comments.json', 'utf-8'));
            const comments = jsonData.comments;
            for (const cmnt of comments) {
              comment_id = cmnt.id
              if (cmnt.author.login == 'author-name' || cmnt.body == 'foo') {
                github.rest.issues.deleteComment({
                  owner: context.repo.owner,
                  repo: context.repo.repo,
                  comment_id: comment_id,
                })
              }
            }

This fails with:

 status: 404,
  response: {
    url: 'https://api.github.com/repos/MyOrganization/MyRepo/issues/comments/IC_kwDODse5xs5r1sLf',
    status: 404,
.
.
.
主要言語
TypeScript
スター
5k
フォーク
586
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

actions/github-script のほかの issue

actions/github-script の issue をすべて見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。