mbrobbel / rustfmt-check

GitHub Action to format Rust code using rustfmt
MIT License
30 stars 6 forks source link

possibility of race condition in commit mode? #1004

Closed pdeva closed 2 weeks ago

pdeva commented 2 months ago

can this action run in this race condition when in commit mode?:

  1. commit A is pushed in a PR
  2. rustfmt-check is running and detects it needs to push a commit with formatted rust code and pushes commit B.
  3. meanwhile user pushed commit C with new code.
  4. commit B from rustfmt-check arrives later than commit C, and this commit B ends up overwriting commit C.
mbrobbel commented 2 months ago

B from the rustfmt-check would be rejected if it's pushed after C.

We would have to explicitly set force with updateRef to overwrite.