-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (44 loc) · 1.67 KB
/
news.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Check news
on:
pull_request:
branches:
- main
env:
python-version: '3.10'
dependabot_user: "dependabot[bot]"
permissions:
contents: read
jobs:
# Check that a news file has been added to this branch when a PR is created
assert-news:
name: Assert news files (See CONTRIBUTING.md)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# Checkout with full history for to allow compare with base branch
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Towncrier is written in Python
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Check for dependabot user
if: github.event.pull_request.user.login == env.dependabot_user
run: |
echo "::warning:: Skipping news file check as this is a dependency update and not included in the release notes."
- name: Install CI tools
if: github.event.pull_request.user.login != env.dependabot_user
run: pip install towncrier
# Fetch the base branch for the pull request so that towncrier can compare the current branch with the base branch.
- name: Check for news fragments
if: github.event.pull_request.user.login != env.dependabot_user
run: |
git fetch --no-tags origin +refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH}
python -m towncrier.check --compare-with origin/${BASE_BRANCH}
env:
BASE_BRANCH: ${{ github.base_ref }}
- name: Report failure if needed
if: ${{ failure() }}
run: |
echo "::error:: News file missing (See CONTRIBUTING.md guide for details)."