ploomber / pkgmt

A toolkit for managing Python packages. 📦🐍
https://pkgmt.readthedocs.io/
MIT License
10 stars 10 forks source link

speeding up pull requests #31

Closed edublancas closed 1 year ago

edublancas commented 1 year ago

when reviewing pull requests, the reviewer must manually check a lot of stuff. we could write a script to automate this.

edublancas commented 1 year ago

implemented it as a github action. will start testing this in some repos

name: check-changelog

on: [pull_request]

jobs:
  # check that the changelog has been modified. If not, post a message to the PR
  check-changelog:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Check PR
        id: changelog
        continue-on-error: true
        run: |

          # check if changelog has been modified
          git fetch origin $GITHUB_BASE_REF:$GITHUB_BASE_REF --depth 1
          git --no-pager diff --name-only --diff-filter=ACMRT $GITHUB_BASE_REF | grep CHANGELOG.md

      - uses: actions/github-script@v5
        if: steps.changelog.outcome == 'failure'
        with:
          github-token: ${{secrets.GITHUB_TOKEN}}
          script: |
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: 'changelog unmodified!'
            })