diff --git a/.github/actions/rename_towncrier/rename_towncrier.py b/.github/actions/rename_towncrier/rename_towncrier.py index 4fe6f556dba..a6183998449 100755 --- a/.github/actions/rename_towncrier/rename_towncrier.py +++ b/.github/actions/rename_towncrier/rename_towncrier.py @@ -54,15 +54,3 @@ print(f"Renaming {fro} to {to}") if real: subprocess.check_call(["git", "mv", fro, to]) -else: - exit(0) -if real: - subprocess.check_call( - ["git", "commit", "-am", f"DOC: Rename towncrier file(s) for PR {pr_num}"] - ) - subprocess.check_call(["git", "push"]) - print( - "Pushed commit to GitHub, exiting with failing status to prevent further " - "checks" - ) - exit(1) # don't proceed with other checks diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index f77e6580ba3..8688bb86089 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -17,13 +17,18 @@ jobs: defaults: run: shell: bash -el {0} + permissions: + contents: write steps: - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.ref }} - token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }} + ref: ${{ github.head_ref }} - run: actions/setup-python@v5 - run: | pip install --upgrade towncrier pygithub python ./.github/actions/rename_towncrier/rename_towncrier.py - - uses: larsoner/action-towncrier-changelog@co # revert to scientific-python @ 0.1.1 once bug is fixed + - uses: stefanzweifel/git-auto-commit-action@v5 + id: commit-action + - run: exit 1 + if: steps.commit-action.outputs.changes_detected == 'false' + # - uses: larsoner/action-towncrier-changelog@co # revert to scientific-python @ 0.1.1 once bug is fixed