-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(internal/actions): refactor changefinder (#7884)
Refactors `changefinder` to support nested submodules i.e. `vision/v2`. Changes the default compare the current `HEAD` against `origin/main`. Add a `-q` quiet mode, all logs will be buffered and dumped in the event of an error. Add a `-dir` flag to specify a different root dir than the default of `cwd`. Add a `-format` flag with values `plain` (stdout, new line delimited), and `github` (prints github action output). Defaults to `plain`. Add a `-gh-var` flag that accepts the name of the GitHub variable the output should set, defaults to `submodules`. This will be able to replace the git-fu used in the `apidiff` workflow and it can power a "change description" action, basically the inverse of the `apidiff` workflow that reports the _added_ surfaces. Try it out by running the following: ``` cd $GOOGLE_CLOUD_GO git checkout origin owl-bot-copy go run ./internal/actions/cmd/changefinder -q ```
- Loading branch information
Showing
2 changed files
with
125 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# changefinder | ||
|
||
`changefinder` will compare the current branch to the `origin/master` branch | ||
then determine which submodules, excluding `internal` submodules, had changes, | ||
and list them on `stdout`. The default is emit them in a simple newline | ||
delimited list. | ||
|
||
The available flags are as follows: | ||
* `-dir=[absolute path]`: The directory to diff, defaults to current working | ||
directory. | ||
* `-q`: Enables quiet mode with no logging. In the event of an error while in | ||
quiet mode, all logs that were surpressed are dumped with the error. Defaults | ||
to `false` (i.e. "verbose"). | ||
* `-format=[plain|github]`: The `stdout` output format. Default is `plain`. | ||
* `-gh-var=[variable name]`: The variabe name to set output for in `github` | ||
format mode. Defaults to `submodules`. | ||
|
||
Example usages from this repo root: | ||
|
||
```sh | ||
# targeting a git repository other than current working directory | ||
go run ./internal/actions/cmd/changefinder -dir /path/to/your/go/repo | ||
|
||
# quiet mode, github format | ||
go run ./internal/actions/cmd/changefinder -q -format=github | ||
|
||
# quiet mode, github format, github var name "foo" | ||
go run ./internal/actions/cmd/changefinder -q -format=github -gh-var=foo | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters