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
22 changes: 21 additions & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ jobs:
fi

- name: Check for changelog fragment
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
# Check for any new fragment files in any .changelog/ directory
fragments=$(git diff --diff-filter=A --name-only FETCH_HEAD -- '**/.changelog/*' '.changelog/*' | grep -v '.gitignore' || true)
if [[ -z "$fragments" ]]; then
echo "No changelog fragment found for this PR."
echo ""
echo "Add a file named .changelog/${{ github.event.pull_request.number }}.<type>"
echo "Add a file named .changelog/${PR_NUMBER}.<type>"
echo "where <type> is one of: added, changed, deprecated, removed, fixed"
echo ""
echo "For coordinated packages, add to the root .changelog/ directory."
Expand All @@ -57,6 +59,24 @@ jobs:
echo "Or add the \"Skip Changelog\" label if this job should be skipped."
exit 1
fi
invalid=()
while IFS= read -r f; do
base=$(basename "$f")
if [[ ! "$base" =~ ^([0-9]+)\.(added|changed|deprecated|removed|fixed)$ ]]; then
Comment thread
xrmx marked this conversation as resolved.
invalid+=("$f (expected <PR_NUMBER>.<type>; type one of added, changed, deprecated, removed, fixed)")
continue
fi
if [[ "${BASH_REMATCH[1]}" != "${PR_NUMBER}" ]]; then
invalid+=("$f (PR number ${BASH_REMATCH[1]} does not match this PR's number ${PR_NUMBER})")
fi
done <<< "$fragments"
if (( ${#invalid[@]} > 0 )); then
echo "Invalid changelog fragment(s):"
for msg in "${invalid[@]}"; do
echo " $msg"
done
exit 1
fi
echo "Found changelog fragment(s):"
echo "$fragments"

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ issue_format = "[#{issue}](https://github.com/open-telemetry/opentelemetry-pytho
wrap = true
issue_pattern = "^(\\d+)"

# NOTE: remember to update the changelog workflow if these types change
[[tool.towncrier.type]]
directory = "added"
name = "Added"
Expand Down
Loading