united-states
In the US such endorsements are legal, ans in fact quite common.
If the actor has been paid to endorse or advertise the band or group, then under 5 USC 45 there might be an obligation to disclose such payments.
FTC Guidance in 16 CFR Part 255 which interprets 5 USC 45 , provides (in Section 255.5) the following examples:
Example 2: A film star endorses a particular food product. The endorsement regards only points of taste and individual preference. This endorsement must, of course, comply with §255.1; but regardless of whether the star’s compensation for the commercial is a $1 million cash payment or a royalty for each product sold by the advertiser during the next year, no disclosure is required because such payments likely are ordinarily expected by viewers.
Example 3: During an appearance by a well-known professional tennis player on a television talk show, the host comments that the past few months have been the best of her career and during this time she has risen to her highest level ever in the rankings. She responds by attributing the improvement in her game to the fact that she is seeing the ball better than she used to, ever since having laser vision correction surgery at a clinic that she identifies by name. She continues talking about the ease of the procedure, the kindness of the clinic’s doctors, her speedy recovery, and how she can now engage in a variety of activities without glasses, including driving at night. The athlete does not disclose that,
even though she does not appear in commercials for the clinic, she has a contractual relationship with it, and her contract pays her for speaking publicly about her surgery when she can do so. Consumers might not realize that a celebrity discussing a medical procedure
in a television interview has been paid for doing so, and knowledge of such payments would likely affect the weight or credibility consumers give to the celebrity’s endorsement.
Without a clear and conspicuous disclosure that the athlete has been engaged as a spokesperson for the clinic, this endorsement is likely to be deceptive.
Furthermore, if consumers are likely to take away from her story that her experience was typical of those
who undergo the same procedure at the clinic, the advertiser must have substantiation for that claim.
Note that teh exzct cicrumstances of when such a disclosure is required vary with the detailed facts.
(thanks to user ohwilleke's comment for the relevant link)