Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIをトリガーする条件に pull_request を追加 #124

Merged
merged 2 commits into from
Sep 20, 2022

Conversation

ken3ypa
Copy link
Contributor

@ken3ypa ken3ypa commented Sep 20, 2022

概要

  • 「fork運用でPRを作成した際、CIの実行がApproveされても実行されない」という現象に対するPRです

やったこと

  • CI をトリガーするタイミングに on: pull_request を追加し、push に branches master 条件を追加
    • fork運用でPRを出した際にもCIがトリガーされる & 二重で CI がトリガーされないようにしています

関連

Comment on lines 3 to 4
- push
- pull_request
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Requestが作成されたタイミングで on.push も発火してしまうので、on.push は デフォルトブランチのみに制限するのはどうでしょう?

Suggested change
- push
- pull_request
push:
branches:
- master
pull_request:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます〜!
おっしゃる通り、push と pull_request.open の2回でCIをフックしてしまいそうなので、bc8c427 にて修正しました 🙌

@ken3ypa ken3ypa force-pushed the fix-workflow-trigger-timing branch from 7a82e8d to bc8c427 Compare September 20, 2022 04:17
@ken3ypa
Copy link
Contributor Author

ken3ypa commented Sep 20, 2022

📝

image

入れた差分

❯ git diff
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index dc07756..a23486e 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,6 +1,7 @@
 name: test
-on: push
-
+on:
+  - push
+  - pull_request
 jobs:
   test-all:
     runs-on: ubuntu-latest

@ken3ypa ken3ypa marked this pull request as ready for review September 20, 2022 05:41
Copy link
Contributor

@ku00 ku00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMです!

@ku00 ku00 merged commit 1ae55d2 into pepabo:master Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants