Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider d0a620c6 rédigé par Andrew Ferrazzutti's avatar Andrew Ferrazzutti Validation de GitHub
Parcourir les fichiers

Add towncrier (#787)


* Add towncrier

Signed-off-by: default avatarAndrew Ferrazzutti <andrewf@element.io>

* .gitkeep -> git.keep

Signed-off-by: default avatarAndrew Ferrazzutti <andrewf@element.io>

* Remove unused changelog-check script

check-newsfragment script is used instead

Signed-off-by: default avatarAndrew Ferrazzutti <andrewf@element.io>

* Update check-newsfragment script

- Link to the correct PR guidelines
- Filter out git.keep

Signed-off-by: default avatarAndrew Ferrazzutti <andrewf@element.io>
parent ca50fa5e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
name: Newsfile
on:
push:
branches: ["develop", "release-*"]
pull_request:
workflow_dispatch:
jobs:
changelog:
if: ${{ github.base_ref == 'develop' || contains(github.base_ref, 'release-') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/setup-python@v2
- run: pip install towncrier==21.9.0
- run: scripts/check-newsfragment
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}
Add automatic changelog generation via [Towncrier](https://github.com/twisted/towncrier).
[tool.towncrier]
# The name of your Python package
filename = "CHANGELOG.md"
directory = "changelog.d"
issue_format = "[\\#{issue}](https://github.com/matrix-org/matrix-appservice-discord/issues/{issue})"
[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bugfixes"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Improved Documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "removal"
name = "Deprecations and Removals"
showcontent = true
[[tool.towncrier.type]]
directory = "misc"
name = "Internal Changes"
showcontent = true
#!/bin/bash
VERSION=`python3 -c "import json; f = open('./package.json', 'r'); v = json.loads(f.read())['version']; f.close(); print(v)"`
towncrier build --version $VERSION $1
#!/usr/bin/env bash
#
# A script which checks that an appropriate news file has been added on this
# branch.
echo -e "+++ \033[32mChecking newsfragment\033[m"
set -e
# make sure that origin/develop is up to date
git remote set-branches --add origin develop
git fetch -q origin develop
pr="$PULL_REQUEST_NUMBER"
# Print a link to the contributing guide if the user makes a mistake
CONTRIBUTING_GUIDE_TEXT="!! Please see the contributing guide for help writing your changelog entry:
https://github.com/matrix-org/matrix-appservice-bridge/blob/develop/CONTRIBUTING.md#%EF%B8%8F-pull-requests"
# If check-newsfragment returns a non-zero exit code, print the contributing guide and exit
python3 -m towncrier.check --compare-with=origin/develop || (echo -e "$CONTRIBUTING_GUIDE_TEXT" >&2 && exit 1)
echo
echo "--------------------------"
echo
matched=0
for f in $(git diff --diff-filter=d --name-only FETCH_HEAD... -- changelog.d | grep -xv changelog.d/git.keep); do
# check that any added newsfiles on this branch end with a full stop.
lastchar=$(tr -d '\n' < "$f" | tail -c 1)
if [ "$lastchar" != '.' ] && [ "$lastchar" != '!' ]; then
echo -e "\e[31mERROR: newsfragment $f does not end with a '.' or '!'\e[39m" >&2
echo -e "$CONTRIBUTING_GUIDE_TEXT" >&2
exit 1
fi
# see if this newsfile corresponds to the right PR
[[ -n "$pr" && "$f" == changelog.d/"$pr".* ]] && matched=1
done
if [[ -n "$pr" && "$matched" -eq 0 ]]; then
echo -e "\e[31mERROR: Did not find a news fragment with the right number: expected changelog.d/$pr.*.\e[39m" >&2
echo -e "$CONTRIBUTING_GUIDE_TEXT" >&2
exit 1
fi
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter