@@ -766,3 +766,62 @@ jobs:
766766 arguments : --all-features --workspace
767767 command-arguments : -Dwarnings -Aunmatched-organization
768768 rust-version : ${{ env.REPO_MSRV }}
769+
770+ changelog :
771+ timeout-minutes : 2
772+
773+ name : Check `CHANGELOG` for errors
774+ runs-on : ubuntu-latest
775+
776+ steps :
777+ - name : Checkout repo
778+ uses : actions/checkout@v5
779+
780+ - uses : actions/github-script@v7
781+ id : get-pull
782+ with :
783+ script : |
784+ let pr = (await github.rest.pulls.get({
785+ owner: context.repo.owner,
786+ repo: context.repo.repo,
787+ pull_number: context.issue.number
788+ })).data
789+
790+ let is_fork = pr.head.repo.fork && (pr.base.repo.clone_url !== pr.head.repo.clone_url)
791+
792+ if (is_fork) {
793+ let head_repo = await github.rest.repos.get({
794+ owner: pr.head.repo.owner.login,
795+ repo: pr.head.repo.name
796+ })
797+ head_repo = head_repo.data
798+ pr.base.repo.clone_url = head_repo.parent.clone_url
799+ }
800+
801+ let pull = {
802+ is_fork,
803+ base_git: pr.base.repo.clone_url,
804+ }
805+
806+ console.log(pull)
807+ return pull
808+
809+ - name : Get base branch
810+ shell : bash
811+ run : |
812+ REMOTE=origin
813+ if ${{ fromJSON(steps.get-pull.outputs.result).is_fork }}; then
814+ git remote add upstream ${{ fromJSON(steps.get-pull.outputs.result).base_git }}
815+ git fetch upstream
816+ REMOTE=upstream
817+ fi
818+ git branch -f ${{ github.base_ref }} $REMOTE/${{ github.base_ref }}
819+
820+ - name : Caching
821+ uses : Swatinem/rust-cache@v2
822+ with :
823+ key : clippy-${{ matrix.target }}-${{ matrix.kind }}-${{ env.CACHE_SUFFIX }}
824+
825+ - name : Run `cargo xtask changelog …`
826+ run : |
827+ cargo xtask changelog "${{ github.base_ref }}"
0 commit comments