nedbat / scriv

Changelog management tool
https://scriv.readthedocs.io
Apache License 2.0
260 stars 29 forks source link

Provide a "check" command #29

Open nedbat opened 3 years ago

nedbat commented 3 years ago

For use in CI, to check if a pull request has followed the right procedure: did it add a new fragment, and does the fragment have content.

Question:

sirosen commented 3 years ago

I've recently setup a GitHub Actions workflow which does this, including the label to exclude a PR.

example GitHub workflow ```yaml name: has_changelog on: - pull_request jobs: check_has_news_in_changelog_dir: if: ${{ ! contains(github.event.pull_request.labels.*.name, 'no-news-is-good-news') }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: # do a deep fetch to allow merge-base and diff fetch-depth: 0 - name: check PR adds a news file run: | news_files="$(git diff --name-only "$(git merge-base origin/main "$GITHUB_SHA")" "$GITHUB_SHA" -- changelog.d/*.md)" if [ -n "$news_files" ]; then echo "Saw new files. changelog.d:" echo "$news_files" else echo "No news files seen" exit 1 fi ```

It would be great to replace the bash with something from scriv. I don't think it should try to replace the label check, but that an example GitHub Actions workflow like the above could go into the docs (with room for other CI systems, if anyone contributes example configs).

I would be happy to put in a PR to add something, or at least get it started! If this would be welcome, I have two questions: