Access the latest job artifacts by URL respecting who triggered the pipeline

Here describe how to download latest job artifacts:

I expect to get the artifact of last job triggered by master branch with the following URL:

But if another tag, or branch, triggers another pipeline for the same commit, then I’m getting this artifact instead of the triggered by the main branch.

How I can limit to get only ones triggered by the main branch?