Lawmakers reach deal to avert government shutdown