Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Exercices 1ere
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Info_Sismondi
Exercices 1ere
Commits
25048924
Commit
25048924
authored
4 months ago
by
Vincent Namy (EDU_GE)
Browse files
Options
Downloads
Patches
Plain Diff
Mettre à jour le fichier .gitlab-ci.yml
parent
3774c25d
No related branches found
No related tags found
No related merge requests found
Pipeline
#36918
failed
4 months ago
Stage: format
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+35
-0
35 additions, 0 deletions
.gitlab-ci.yml
with
35 additions
and
0 deletions
.gitlab-ci.yml
+
35
−
0
View file @
25048924
stages
:
-
format
format_files
:
stage
:
format
image
:
python:3.10
before_script
:
-
pip install jq nbformat
script
:
-
git fetch --unshallow ||
true
-
git fetch origin $CI_COMMIT_REF_NAME
-
git checkout $CI_COMMIT_SHA
# Identifier les fichiers modifiés
-
MODIFIED_JSON_FILES=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA | grep '\.json$' ||
true
)
-
MODIFIED_IPYNB_FILES=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA | grep '\.ipynb$' ||
true
)
-
echo "Modified JSON files:" $MODIFIED_JSON_FILES
-
echo "Modified IPYNB files:" $MODIFIED_IPYNB_FILES
# Formatage des fichiers JSON
-
for file in $MODIFIED_JSON_FILES; do
jq . "$file" > "$file.formatted" && mv "$file.formatted" "$file";
done
# Formatage des fichiers IPYNB
-
for file in $MODIFIED_IPYNB_FILES; do
python -m nbformat --to notebook --input "$file" --output "$file.formatted" && mv "$file.formatted" "$file";
done
# Ajouter et pousser les modifications
-
git config --global user.email "ci-bot@example.com"
-
git config --global user.name "CI Bot"
-
git add $MODIFIED_JSON_FILES $MODIFIED_IPYNB_FILES
-
git commit -m "Formatted JSON and IPYNB files" || echo "No changes to commit."
-
git push origin $CI_COMMIT_REF_NAME
rules
:
-
changes
:
-
"
*.json"
-
"
*.ipynb"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment