Skip to content

Commit

Permalink
Merge branch 'ko3n1g/ci/fix-auto-format-forks' into 'main'
Browse files Browse the repository at this point in the history
ci: Disable auto-format on forks

See merge request ADLR/megatron-lm!2337
  • Loading branch information
ko3n1g committed Nov 12, 2024
2 parents e4e9141 + 8666fdb commit aded519
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions .gitlab/stages/01.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,20 +231,21 @@ test:formatting:
if [[ "$CI_PIPELINE_SOURCE" != "merge_request_event" ]]; then
exit 0
fi
- set +e
- git fetch origin $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
- git fetch origin main:main
- git checkout $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
- bash tools/autoformat.sh
- set -e
- git config --global user.email "[email protected]"
- git config --global user.name "Mcore Bot"
- git remote set-url origin "https://gitlab-ci-token:${PAT}@${GITLAB_ENDPOINT}/$CI_PROJECT_NAMESPACE/megatron-lm.git"
- git add -A .
- >
git commit -m "chore: Format files" || true
- git push -u origin $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
- |
if [[ "$CI_MERGE_REQUEST_PROJECT_PATH" == "$CI_MERGE_REQUEST_SOURCE_PROJECT_PATH" ]]; then
bash tools/autoformat.sh
set -e
git config --global user.email "[email protected]"
git config --global user.name "Mcore Bot"
git remote set-url origin "https://gitlab-ci-token:${PAT}@${GITLAB_ENDPOINT}/$CI_PROJECT_NAMESPACE/megatron-lm.git"
git add -A .
git commit -m "chore: Format files" || true
git push -u origin $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
fi
- env
- BASE_REF="$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" CHECK_ONLY=true SKIP_DOCS=$([[ "$CI_MERGE_REQUEST_LABELS" == *"Skip docs"* ]] && echo "true" || echo "false") bash tools/autoformat.sh

Expand Down

0 comments on commit aded519

Please sign in to comment.