diff --git a/.github/workflows/create-pr-when-pr-is-merged.yml b/.github/workflows/create-pr-when-pr-is-merged.yml index 449052cb..3ad1c52b 100644 --- a/.github/workflows/create-pr-when-pr-is-merged.yml +++ b/.github/workflows/create-pr-when-pr-is-merged.yml @@ -61,7 +61,11 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # used by gh run: | - echo "count=$(gh pr list -S head:${{ env.BRANCH_NAME }} -B ${{ env.BASE_BRANCH_NAME }} | wc -l)" >> "$GITHUB_OUTPUT" + # echo "count=$(gh pr list -S head:${{ env.BRANCH_NAME }} -B ${{ env.BASE_BRANCH_NAME }} | wc -l)" >> "$GITHUB_OUTPUT" + pulls=$(curl -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/nakamasato/github-actions-practice/pulls?head=nakamasato:${{ env.BRANCH_NAME }}&base=${{ env.BASE_BRANCH_NAME }}") + echo "$pulls" + count=$(echo "$pulls" | jq '. | length') + echo "count=$count" >> "$GITHUB_OUTPUT" - name: create pr if: ${{ steps.need_commit.outputs.need_commit == 'true' && steps.check_pr.outputs.count == 0 }}