Does limiting managers' discretion limit organizations' scope for discrimination? Social-psychological research argues that it limits opportunities to exercise cognitive biases. Organizational research has found that formal personnel practices that establish accountability for workplace diversity have increased women and minority representation in management. However, drawing causal inferences from such studies is complicated because adopting such policies may be endogenous to the firm's wish to hire and promote women and minorities. This study uses unionization elections to conduct a regression-discontinuity test from which stronger causal inferences can be made. It finds that while unionization is associated with more representative workplaces and more women and minorities in management, these effects disappear close to the discontinuity threshold. Most of the effects of unionization on workforce diversity may be attributable to the unobserved drivers of selection into unionization. This has similar implications for the causal effects of diversity policies adopted by managers.