Opening a PR right after pushing runs the dry run twice and posts two comments

Đang mở
#1,139 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

  • #1140 của @TovaBecker — đã đóng, không merge

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
66/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github, javascript
Lĩnh vực
ci-cd, devtools

Hướng nghiên cứu

Start in index.js and trace the check_suite.requested and pull_request.opened handlers into createCheckRun. Check how existing “Safe-setting validator” check runs for the same head_sha can be found, then add or run focused coverage for the push and PR opening arriving close together. Done means one dry run and one PR comment per commit.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

When a PR is opened within a few seconds of pushing its branch, safe-settings creates two "Safe-setting validator" check runs on the same commit. Both run the dry run, and each posts its own PR comment, so the PR gets two identical comments.

Seen on 3.0.0 (df84f83): two check runs on the same head commit, started 3 seconds apart, and two identical comments.

Cause

Two handlers in index.js call createCheckRun for the same commit:

  1. check_suite.requested fires on the push. If the PR already exists, the payload lists it, so a check run is created.
  2. pull_request.opened fires when the PR is created and always creates a check run.

When the PR is created right after the push (for example gh pr create, or Create pull request right after committing in the web editor), both events see the PR.

Expected

One dry run and one comment per commit.

Possible fix

In createCheckRun, skip creating a check run if a "Safe-setting validator" check run already exists for the same head_sha.

Related: #737 (same symptom after a later push), #1015 (check_suite.rerequested is registered twice, so a re-run can also run twice).

Ngôn ngữ chính
JavaScript
Star
942
Fork
238
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github-community-projects/safe-settings

Tất cả issue của github-community-projects/safe-settings

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.