diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..ff2c165 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +/.github/CODEOWNERS @neo4j/drivers +/.github/workflows/ @neo4j/drivers diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a47f72b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: daily + cooldown: + default-days: 3 + open-pull-requests-limit: 5 + labels: + - "no changelog" + assignees: + - "robsdedude" diff --git a/.github/workflows/changelog_entry.yaml b/.github/workflows/changelog_entry.yaml new file mode 100644 index 0000000..ea04737 --- /dev/null +++ b/.github/workflows/changelog_entry.yaml @@ -0,0 +1,55 @@ +name: Changelog Entry + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + +permissions: + contents: read + pull-requests: read + +jobs: + check: + name: Check changelog entry + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Verify changelog entry or "no changelog" label + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + run: | + set -euo pipefail + if echo "$LABELS" | jq -e 'index("no changelog")' > /dev/null; then + echo "PR is labeled 'no changelog' - skipping check." + exit 0 + fi + expected="^changelog\\.d/${PR_NUMBER}\\.[^/]+\\.md$" + matching=$(gh api "repos/$REPO/pulls/$PR_NUMBER/files" --paginate \ + | jq -r '.[] | select(.status == "added") | .filename' \ + | grep -E "$expected" \ + || true) + if [ -z "$matching" ]; then + echo "::error::PR must add a file named 'changelog.d/${PR_NUMBER}..md' or carry the 'no changelog' label." + echo "See changelog.d/README.md for how to create an entry." + exit 1 + fi + echo "Found new changelog entry/entries:" + echo "$matching" + echo "Checking changelog entries contain '' placeholder on the first line..." + missing=() + while IFS= read -r file; do + if ! head -n 1 "$file" | grep -qF ''; then + missing+=("$file") + fi + done <<< "$matching" + if [ ${#missing[@]} -gt 0 ]; then + echo "::error::The following changelog entries must contain '' on the first line:" + for f in "${missing[@]}"; do + echo " - $f" + done + echo "See changelog.d/README.md for the expected format." + exit 1 + fi diff --git a/changelog.d/README.md b/changelog.d/README.md index 21b1f4e..9b30479 100644 --- a/changelog.d/README.md +++ b/changelog.d/README.md @@ -1,13 +1,17 @@ +# How To Changelog + To create a new entry, you can run: + ```bash towncrier create "." ``` + This will create a new file in the `changelog.d/` directory for you to fill in. If there is no issue or PR number, you can use `+.` instead. The `` determines how the entry will be grouped in the changelog. For available types, see the `[[tool.towncrier.type]]` entries in the `pyproject.toml` file. -You can include `` in the entry to determine where the list of PR/issue links goes. +The entry's first line must include `.` to determine where the list of PR/issue links goes. Usually, the entries will look like this: ```markdown @@ -15,6 +19,7 @@ Some summary of the change. ``` or if there's more to say (note the trailing spaces after the first line): + ```markdown Some summary of the change. Some more details. Feel free to use markdown features like