actions: Cleanup using context managers for lock

Signed-off-by: Joe MacMahon <joe.macmahon@cern.ch>