Below is an extract from the GDPR
"8Lawfulness of processing: public interest etc
In Article 6(1) of the GDPR (lawfulness of processing), the reference in point (e) to processing of personal data that is necessary for the performance of a task carried out in the public interest or in the exercise of the controller’s official authority includes processing of personal data that is necessary for—
(a)the administration of justice,
(b)the exercise of a function of either House of Parliament,
(c)the exercise of a function conferred on a person by an enactment or rule of law,
(d)the exercise of a function of the Crown, a Minister of the Crown or a government department, or(e)an activity that supports or promotes democratic engagement."
https://www.legislation.gov.uk/ukpga/2018/12/section/8/enactedIt looks like sections c and cover the use of personal data for a government warning system,