If you are using a Fedora, or RHEL based distro, then you can use centpkg.
[root@f38 ~]# dnf -y install centpkg
[user@f38 tmp]$ centpkg clone bash
Cloning into 'bash'...
warning: unable to find all commit-graph files
remote: warning: unable to find all commit-graph files
remote: Enumerating objects: 1763, done.
remote: Counting objects: 100% (1685/1685), done.
remote: Compressing objects: 100% (840/840), done.
remote: Total 1763 (delta 874), reused 1610 (delta 827), pack-reused 78
Receiving objects: 100% (1763/1763), 597.20 KiB | 4.46 MiB/s, done.
Resolving deltas: 100% (892/892), done.
[user@f38 tmp]$ cd bash/
[quake@f38 bash]$ centpkg sources
Downloading bash-5.1.tar.gz
######################################################################## 100.0%
[user@f38 bash]$ centpkg srpm
Not downloading already downloaded bash-5.1.tar.gz
setting SOURCE_DATE_EPOCH=1669075200
Wrote: /home/quake/tmp/bash/bash-5.1.8-6.el9.src.rpm
If you need to do that for SIG related work, there is also centpkg-sig