Keep the Artifacts only for 'main' branch and/or the lates job in a pipeline

Gitlab has the option: Keep artifacts from most recent successful jobs in Settings->CI/CD.

This keeps the latest artifacts for each ‘ref’ which also means, that it is kept for each tag. Is there any option to keep the latest artifact only for a dedicated branch (e.g. main?).

Or can I define the expire_in statement with some rules?
In may usecase its good to have the artifacts of the latest job in a pipeline, but not all the jobs done before…