Skip to content

Commit

Permalink
ci(jscpd): merge target branch in jscpd to avoid false negatives. (#6572
Browse files Browse the repository at this point in the history
)

## Problem
- Follow up to
#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]>
  • Loading branch information
Hweinstock and justinmk3 authored Feb 18, 2025
1 parent 8be5858 commit 46d76cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/filterDuplicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ async function run() {
console.log('%s duplicates found', filteredDuplicates.length)
if (filteredDuplicates.length > 0) {
console.log(formatDuplicates(filteredDuplicates, commitHash, repoName))
console.log(
'* Hint: if these duplicates appear unrelated to the changes, rebase onto the latest target branch.'
)
process.exit(1)
}
}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ jobs:
git remote add forkUpstream https://github.com/$REPO_NAME # URL of the fork
git fetch forkUpstream # Fetch fork
- name: Merge in target branch to avoid false negatives.
env:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
# Note: "git merge" should always succeed here, because GHA won't
# start the job if there are merge conflicts. https://github.com/orgs/community/discussions/11265
# Also, because `git merge` makes a commit, we need to establish an identity to avoid 'Committer identity unknown' error
run: |
git config --global user.name "aws-toolkit-automation"
git config --global user.email "<>"
git merge origin/$TARGET_BRANCH
- name: Compute git diff
env:
CURRENT_BRANCH: ${{ github.head_ref }}
Expand Down

0 comments on commit 46d76cb

Please sign in to comment.