Skip to content

Commit 46d76cb

Browse files
ci(jscpd): merge target branch in jscpd to avoid false negatives. (aws#6572)
## Problem - Follow up to aws#6564 (review). ## Solution - It appears that there is an undocumented "feature" that GHA don't run when there is a merge conflict. See [here](https://github.com/orgs/community/discussions/11265) - This means we don't have to handle the failure case where a merge fails. - Add fake config identity to mitigate this error: <img width="913" alt="image" src="https://github.com/user-attachments/assets/cd426ec7-e1ca-4d13-a3b1-3985b5593c07" /> ## Notes Going to let this sit and make sure it works as changes are merged into master. --- - 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. --------- Co-authored-by: Justin M. Keyes <[email protected]>
1 parent 8be5858 commit 46d76cb

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/filterDuplicates.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ async function run() {
111111
console.log('%s duplicates found', filteredDuplicates.length)
112112
if (filteredDuplicates.length > 0) {
113113
console.log(formatDuplicates(filteredDuplicates, commitHash, repoName))
114-
console.log(
115-
'* Hint: if these duplicates appear unrelated to the changes, rebase onto the latest target branch.'
116-
)
117114
process.exit(1)
118115
}
119116
}

.github/workflows/node.js.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ jobs:
8484
git remote add forkUpstream https://github.com/$REPO_NAME # URL of the fork
8585
git fetch forkUpstream # Fetch fork
8686
87+
- name: Merge in target branch to avoid false negatives.
88+
env:
89+
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
90+
# Note: "git merge" should always succeed here, because GHA won't
91+
# start the job if there are merge conflicts. https://github.com/orgs/community/discussions/11265
92+
# Also, because `git merge` makes a commit, we need to establish an identity to avoid 'Committer identity unknown' error
93+
run: |
94+
git config --global user.name "aws-toolkit-automation"
95+
git config --global user.email "<>"
96+
git merge origin/$TARGET_BRANCH
97+
8798
- name: Compute git diff
8899
env:
89100
CURRENT_BRANCH: ${{ github.head_ref }}

0 commit comments

Comments
 (0)