cwtools / cwtools-action

Run CWTools on your Clausewitz mod PDXScript code in parallel to your builds thanks to GitHub Actions.
MIT License
13 stars 5 forks source link

Investigate whether it's possible to use git fetch for GitLab. #3

Open tboby opened 4 years ago

tboby commented 4 years ago

Currently using GIT_STRATEGY: fetch (the default) results in cwtools-action failing on GitLab. This is because reviewdog needs both the source and target branches of the merge request to be present for the git diff it does.

Git clone seems to solve this, and is more reliable. However, for large mods it can be quite slow to clone even just the last 50 commits, so it would be preferable to use git fetch.

This issue tracks any progress towards that. Please emote if this is something that affects you!

hiddengearz commented 4 years ago

Maybe you can do the fetch yourself outside of git strategy? I never used it in my script. Also if you're fortunate to use the same public runner (or host one yourself like i do) the container will still have your mods files thus not having to do a full clone.

My gitlab CI is the following:

  - StandardsTest
  - StylingTest
  - FixStyling

CodingStandards:
  stage: StandardsTest
  image: python:3.6
  only:
    - merge_requests
  script:
    - pip install requests
    - python3 tools/coding_standards.py $Bot_Token

Styling:
  stage: StylingTest
  image: python:3.6
  only:
    - merge_requests
  script:
    - pip install requests
    - python3 tools/check_basic_style_2.py $Bot_Token

FixingStyling:
  stage: FixStyling
  image: python:3.6
  only:
    - merge_requests
  script:
    - pip install requests
    - python3 tools/fix_styling.py $Bot_Token
  after_script:
    - git config --global user.email "an email adress"
    - git config --global user.name "a user name"
    - git config --global push.default simple
    - git remote set-url origin https://aUserNameIRemoved:$Bot_Token@gitlab.com/Millennium_Dawn/Millennium_Dawn.git
    - git add -A
    - git commit -m 'Fixed Styling for you'
    - git push -u origin HEAD:$CI_COMMIT_REF_NAME
    - python3 tools/check_basic_style.py $Bot_Token
    - python3 tools/check_basic_style_2.py $Bot_Token

  when: on_failure