|
| 1 | +name: Changelog |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, labeled, unlabeled, reopened] |
| 6 | + branches-ignore: |
| 7 | + - master |
| 8 | + |
| 9 | +env: |
| 10 | + DEFAULT_PYTHON: '3.12' |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + check-changelog: |
| 17 | + name: Changelog Entry Check |
| 18 | + runs-on: ubuntu-latest |
| 19 | + timeout-minutes: 10 |
| 20 | + if: "!contains(github.event.pull_request.labels.*.name, 'ci:skip-changelog') && github.event.pull_request.user.login != 'pre-commit-ci[bot]' && github.event.pull_request.user.login != 'dependabot[bot]'" |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Set up Python ${{ env.DEFAULT_PYTHON }} |
| 28 | + id: python |
| 29 | + uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 32 | + |
| 33 | + - name: Install poetry |
| 34 | + uses: snok/install-poetry@v1 |
| 35 | + |
| 36 | + - name: Cache poetry |
| 37 | + uses: actions/cache@v4 |
| 38 | + with: |
| 39 | + path: ~/.cache/pypoetry |
| 40 | + key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-${{ hashFiles('**/poetry.lock') }} |
| 41 | + restore-keys: | |
| 42 | + ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-${{ hashFiles('**/poetry.lock') }} |
| 43 | + ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog- |
| 44 | + ${{ runner.os }}-python |
| 45 | + ${{ runner.os }}- |
| 46 | +
|
| 47 | + - name: Install dependencies |
| 48 | + run: | |
| 49 | + poetry install --no-root --with docs --without dev,test |
| 50 | +
|
| 51 | + - name: Check changelog entry exists |
| 52 | + run: | |
| 53 | + if [ ! -s docs/changelog/next_release/${{ github.event.pull_request.number }}.*.rst ]; then |
| 54 | + echo "Please add corresponding file 'docs/changelog/next_release/<issue number>.<change type>.rst' with changes description" |
| 55 | + exit 1 |
| 56 | + fi |
| 57 | +
|
| 58 | + - name: Validate changelog |
| 59 | + run: |- |
| 60 | + # Fetch the pull request' base branch so towncrier will be able to |
| 61 | + # compare the current branch with the base branch. |
| 62 | + git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }} |
| 63 | + poetry run towncrier check --compare-with origin/${{ github.base_ref }} |
| 64 | + poetry run towncrier --draft |
0 commit comments