Skip to content

Commit

Permalink
chore: add comment in CODEOWNERS about how to update it
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eagle authored and alexeagle committed Jun 11, 2020
1 parent 52c319f commit a7e045b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@rules_codeowners//tools:codeowners.bzl", "generate_codeowners")

generate_codeowners(
name = "gen_codeowners",
generated_comment = "# AUTO GENERATED edits will be lost\n# To update, run:\n# yarn update-codeowners",
# This list is auto-generated by `yarn update-codeowners`
# do not sort
owners = [
Expand Down
5 changes: 3 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was generated by rules_codeowners / Bazel
# Don't edit it directly
# AUTO GENERATED edits will be lost
# To update, run:
# yarn update-codeowners

* @mattem @gregmagolan @soldair @alexeagle
/packages/labs/** @mrmeku @alexeagle @mattem
Expand Down
8 changes: 4 additions & 4 deletions package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ def rules_nodejs_dev_dependencies():

http_archive(
name = "rules_codeowners",
strip_prefix = "rules_codeowners-826b742ee0d6703736c8c4f45fd07d65315cf599",
sha256 = "64f64459b41201f7236880763e72de9384b237dfc44d61949520a2994bff18cd",
patches = ["@build_bazel_rules_nodejs//:rules_codeowners_pr27.patch"],
strip_prefix = "rules_codeowners-bdc2f987cd0e15ebfa9b76689a4c9a472730a6f0",
sha256 = "efd4aba15e25de49e9e68b1517d789c53104b2cf0b05212ce206ed0d44835952",
urls = [
"https://mirror.bazel.build/github.com/zegl/rules_codeowners/archive/826b742ee0d6703736c8c4f45fd07d65315cf599.zip",
"https://github.com/zegl/rules_codeowners/archive/826b742ee0d6703736c8c4f45fd07d65315cf599.zip",
"https://github.com/zegl/rules_codeowners/archive/bdc2f987cd0e15ebfa9b76689a4c9a472730a6f0.zip",
],
)

Expand Down
31 changes: 31 additions & 0 deletions rules_codeowners_pr27.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff tools/codeowners.bzl tools/codeowners.bzl
index e6387a3..93a8cdd 100644
--- tools/codeowners.bzl
+++ tools/codeowners.bzl
@@ -98,8 +98,7 @@ skip_empty_rows () {
grep -v -E '^$'
}

-echo "# This file was generated by rules_codeowners / Bazel" >> "$OUTFILE"
-echo "# Don't edit it directly" >> "$OUTFILE"
+echo "_GENERATED_COMMENT_" >> "$OUTFILE"
echo "" >> "$OUTFILE"

while [ "$#" -gt 0 ]; do
@@ -113,7 +112,7 @@ while [ "$#" -gt 0 ]; do
skip_empty_rows | \
prevent_malicios_input "$must_have_prefix" >> "$OUTFILE"
done
- """,
+ """.replace("_GENERATED_COMMENT_", ctx.attr.generated_comment),
)

generate_codeowners = rule(
@@ -122,6 +121,7 @@ generate_codeowners = rule(
Creates a GitHub-compatible CODEOWNERS file based on the `owners`.
""",
attrs = {
+ "generated_comment": attr.string(default = "# This file was generated by rules_codeowners / Bazel\n# Don't edit it directly"),
"owners": attr.label_list(mandatory = True, doc = "A list of codeowners and generate_codeowners. One generate_codeowners can include another generate_codeonwers to effective acheive nested rules."),
},
outputs = {

0 comments on commit a7e045b

Please sign in to comment.