Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Bug report
description: Report a reproducible problem without private data
title: "Bug: "
body:
- type: markdown
attributes:
value: "Use synthetic examples. Remove credentials, customer information, private URLs, and captured content. Report security issues privately through the repository's Security tab."
- type: input
id: version
attributes:
label: Version or commit
placeholder: "Package version or commit SHA"
- type: textarea
id: reproduction
attributes:
label: Steps to reproduce
description: Include the smallest synthetic example and relevant configuration.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual behavior
validations:
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Feature request
description: Suggest a change to the public project
title: "Feature: "
body:
- type: markdown
attributes:
value: "Describe a general use case. Do not include internal plans, tracker links, or customer-identifying details."
- type: textarea
id: problem
attributes:
label: Problem to solve
validations:
required: true
- type: textarea
id: proposal
attributes:
label: Proposed behavior
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives considered
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## What changed

<!-- Explain the change in public, standalone terms. -->

## Verification

<!-- List the checks you ran and any unverified paths. -->

## Publication check

- [ ] Branch name, commits, diff, fixtures, logs, screenshots, and this PR contain no secrets, private tracker references, or identifying customer data.
- [ ] Security-sensitive details are being reported privately.
13 changes: 13 additions & 0 deletions .github/workflows/publication-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Public contribution check
on: pull_request
jobs:
metadata:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check public references
run: python3 scripts/check_publication.py origin/${{ github.event.repository.default_branch }}
19 changes: 19 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Public contribution rules

This repository is public. Before publishing a branch, commit, issue, pull
request, comment, release, screenshot, fixture, or log:

- Use a self-contained public description. Keep private tracker IDs, links,
discussion, and customer context in the internal tracker. Do not put them in
public branch names, commit messages, issue or PR titles and bodies, or
release notes.
- Remove secrets, tokens, non-public customer or prospect names and domains,
tenant or workspace IDs, captured prompts or responses, private paths, and
cloud account or resource IDs. Use synthetic examples and `example.com`.
- Inspect the exact diff and all metadata before pushing or posting. A CI
failure after publication cannot undo disclosure.
- Report a suspected vulnerability privately to maintainers. Do not include
exploit details in a public issue.

If unsure whether a detail is public, stop and ask before publishing. Existing
harmless issue IDs in history do not, by themselves, require rewriting history.
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contributing

Please use the issue forms for bugs and feature requests, and open a pull
request with a short explanation of the change and how you checked it. Provide
minimal, synthetic reproduction data. Before posting, review your branch name,
commits, diff, logs, screenshots, and PR text for private information. Keep
internal tracker references in the internal tracker.

For a security issue, contact maintainers privately instead of opening a
public issue.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# .github
# Metergraph community defaults

This repository supplies the default issue forms, pull request template, and
contribution guidelines for repositories owned by the `metergraph` GitHub
organization. A repository's own template takes precedence. Repositories in
other organizations need their own copies.

The public publishing rules are in [AGENTS.md](AGENTS.md). Agents working in
another repository need that repository's own `AGENTS.md`; GitHub community
defaults do not place agent instructions in checkouts.
Shared contribution and issue templates for Metergraph repositories
76 changes: 76 additions & 0 deletions scripts/check_publication.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""Check common internal references before a public push or PR.

Usage: python3 scripts/check_publication.py origin/main
This cannot detect all private data. Review the full diff and metadata yourself.
"""

import json
import os
import re
import subprocess
import sys


PATTERNS = {
"internal issue ID": re.compile(r"\b" + "MET" + r"-[0-9]+\b", re.I),
"internal tracker URL": re.compile("linear.app/" + "metergraph", re.I),
"private repository reference": re.compile("PioneerSquareLabs/" + "metergraph-internal", re.I),
}


def git(*args: str) -> str:
return subprocess.check_output(["git", *args], text=True)


def main() -> int:
base = sys.argv[1] if len(sys.argv) > 1 else "origin/main"
try:
metadata = [
("new commits", git("log", "--format=%B", f"{base}..HEAD")),
]
diff = git("diff", "--no-ext-diff", "--unified=0", f"{base}...HEAD", "--")
except subprocess.CalledProcessError as error:
print(f"Could not compare against {base}: {error}", file=sys.stderr)
return 2

event_path = os.environ.get("GITHUB_EVENT_PATH")
if event_path:
with open(event_path, encoding="utf-8") as event_file:
pull_request = json.load(event_file).get("pull_request", {})
metadata.extend(
[
("PR title", pull_request.get("title") or ""),
("PR body", pull_request.get("body") or ""),
]
)

added_lines = "\n".join(
line[1:]
for line in diff.splitlines()
if line.startswith("+") and not line.startswith("+++")
)
metadata.append(("added lines", added_lines))

branch = git("branch", "--show-current").strip()
if event_path:
branch = pull_request.get("head", {}).get("ref") or branch
if PATTERNS["internal issue ID"].search(branch):
print("Review branch name: it appears to contain an internal issue ID.")

findings = [
f"{location}: {name}"
for location, content in metadata
for name, pattern in PATTERNS.items()
if pattern.search(content)
]
if findings:
print("Check these public references before publishing:")
print("\n".join(f"- {finding}" for finding in findings))
return 1

print("No known internal references found. Review for other private data before publishing.")
return 0


if __name__ == "__main__":
raise SystemExit(main())
Loading