-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Move @generated from build to sync #29799
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ebb616f
to
ec55e0e
Compare
ec55e0e
to
77e2b92
Compare
git status | ||
echo "====================" | ||
if git status --porcelain | grep -qv '/REVISION'; then | ||
echo "Changes detected" | ||
echo "===== Changes =====" | ||
git --no-pager diff -U0 | grep '^[+-]' | head -n 50 | ||
echo "===================" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this so that if we ever create diffs we shouldn't, it's easy to debug in the workflow output. I truncate after 50 lines because that's enough to see that there are more than just hash / version changes.
else | ||
echo "No Changes detected" | ||
fi | ||
- name: Revert signatures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is the clever bit. Once we've reverted the version strings, then we can re-generate the headers. If the only difference in the file was the version string, then this will output the same @generated
header, and the working directory will be clean.
if: steps.check_should_commit.outputs.should_commit == 'true' | ||
run: | | ||
echo ":" | ||
git add . | ||
- name: Signing files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the version has been switched back to the new version, we also need to re-sign the files.
@@ -4,7 +4,8 @@ | |||
* This source code is licensed under the MIT license found in the | |||
* LICENSE file in the root directory of this source tree. | |||
* | |||
* @format | |||
* @noformat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was some login in the build switch to flip these files to @noformat
but we can just... make them that way in source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't look him in the eyes… don't look him in the eyes…
Co-authored-by: Timothy Yung <yungsters@gmail.com>
## Overview The clever trick in #29799 turns out to not work because signedsource includes the generated hash in the header. Reverts back to checking git diff, filtering out the REVISION file and `@generated` headers.
Overview
Reverts #26616 and implements the suggested way instead.
This change in #26616 broken the internal sync command, which now results in duplicated
@generated
headers. It also makes it harder to detect changes during the diff train sync. Instead, we will check for changes, and if there are changes sign the files and commit them to the sync branch.Strategy
The new sync strategy accounts for the generated headers during the sync:
Then commit to branch. This ensures that if there are no changes, we'll skip.