From ab937e4dd854175afb490a75cc3c73796521edc0 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 18 Dec 2024 12:37:44 -0800 Subject: [PATCH] ci: editing PR description re-triggers all GitHub Actions #6274 Problem: Since 6dcbfc705d4df, the `lint-commits` job runs whenever the PR *description* is edited, which then re-runs all the other GHA jobs. This is because it listens to the `edited` event, which triggers whenever the PR is edited in any way (very noisy). Solution: There is no way to avoid rerunning all the CI jobs if they are dependent on `lint-commits`. Instead, revert 6dcbfc705d4df and document that re-opening the PR will force CI to re-run, if needed, after fixing a PR title. --- .github/PULL_REQUEST_TEMPLATE.md | 3 +-- .github/workflows/lintcommit.js | 1 + .github/workflows/node.js.yml | 12 ++++-------- .github/workflows/notification.yml | 11 +++-------- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 929388bc246..3b891b24003 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,5 +8,4 @@ - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - -License: I confirm that my contribution is made under the terms of the Apache 2.0 license. +- License: I confirm that my contribution is made under the terms of the Apache 2.0 license. diff --git a/.github/workflows/lintcommit.js b/.github/workflows/lintcommit.js index 9e3f8b40406..4f329223eef 100644 --- a/.github/workflows/lintcommit.js +++ b/.github/workflows/lintcommit.js @@ -130,6 +130,7 @@ Invalid pull request title: \`${title}\` * scope: lowercase, <30 chars * subject: must be <100 chars * documentation: https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#pull-request-title +* Hint: *close and re-open the PR* to re-trigger CI (after fixing the PR title). ` : `Pull request title matches the [expected format](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#pull-request-title).` diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index a7541f39b9c..1c5299c8a2e 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -7,15 +7,10 @@ on: push: branches: [master, staging] pull_request: - branches: [master, feature/*, staging] - # Default = opened + synchronize + reopened. - # We also want "edited" so that lint-commits runs when PR title is updated. + # By default, CI will trigger on opened/synchronize/reopened event types. # https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request - types: - - edited - - opened - - reopened - - synchronize + # Note: To re-run `lint-commits` after fixing the PR title, close-and-reopen the PR. + branches: [master, feature/*, staging] # Cancel old jobs when a pull request is updated. concurrency: @@ -24,6 +19,7 @@ concurrency: jobs: lint-commits: + # Note: To re-run `lint-commits` after fixing the PR title, close-and-reopen the PR. runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/notification.yml b/.github/workflows/notification.yml index ea37b04e0d5..17f0327e5c1 100644 --- a/.github/workflows/notification.yml +++ b/.github/workflows/notification.yml @@ -6,15 +6,10 @@ name: Notifications on: # `pull_request_target` (as opposed to `pull_request`) gives permissions to comment on PRs. pull_request_target: - branches: [master, feature/*, staging] - # Default = opened + synchronize + reopened. - # We also want "edited" so that changelog notifications runs when PR title is updated. + # By default, CI will trigger on opened/synchronize/reopened event types. # https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request - types: - - edited - - opened - - reopened - - synchronize + # Note: To re-run `lint-commits` after fixing the PR title, close-and-reopen the PR. + branches: [master, feature/*, staging] # Cancel old jobs when a pull request is updated. concurrency: