Commit Graph

6 Commits

Author SHA1 Message Date
Martin Atkins
443d470a86 build: FIXME to make goimportscheck.sh work on Bash 3 maybe 2022-08-26 09:47:30 -07:00
Martin Atkins
c2ec25e359 build: goimports check relative to PR base branch
At the risk of a little bit of hidden spooky action at a distance, this
will slightly change the behavior of the "goimports check" to compare
against the base branch of a PR rather than to origin/main if we happen
to find one of the environment variables that GitHub Actions sets
automatically in its runners. This is targeting our "checks.yml" workflow
in particular.

The intention here is to avoid misreporting files that haven't actually
changed when a PR is targeting a branch other than the main branch, such
as directly targeting a historical release branch.

We'll still run against origin/main when we're not running in GitHub
Actions, since that's _typically_ the correct branch to use for new
work, even if it will eventually get backported to a release branch.
2022-08-26 09:47:30 -07:00
Martin Atkins
246686813d build: goimports check supports any number of changed files
The previous implementation of this check tried to accumulate all of the
changed files into a single big string and then run goimports once with
all of them, but that approach ran into problems for changesets of a
certain (platform-specific) size due to limits on maximum command line
length.

This new version instead uses bash arrays and runs goimports separately
for each of the files which appear to have changed relative to the
base branch. This is likely to be slower to complete for changesets that
have many different changed files, but it's better for it to be slow than
to return an error and fail to check some of the files.
2022-08-26 09:47:30 -07:00
Liam Cervante
c4e223c7a0
Only perform the importscheck on added or modified files (#31605) 2022-08-09 16:50:54 +01:00
Liam Cervante
985325a0fc
Remove -local flag from goimports check (#31555) 2022-08-02 15:08:38 +01:00
Liam Cervante
afd273d636
Add goimports as a check to the Github commit actions (#31432)
* Add goimports as a check to the Github commit actions

* check diff against main instead of last commit

* goimports should fix the problems

* fix up conditionals and wildcard matching

* specify origin/main in diff

* fetch main branch when checkout

* back to origin main
2022-07-19 10:14:28 +01:00