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
e79656fb
Commit
e79656fb
authored
4 months ago
by
Vincent N
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of
ssh://ssh.hesge.ch:10572/info_sismondi/exercices-1ere
parents
b235cdf6
91e65840
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+28
-0
28 additions, 0 deletions
.gitlab-ci.yml
with
28 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
28
−
0
View file @
e79656fb
stages
:
-
format
format_files
:
stage
:
format
image
:
python:3.10
before_script
:
-
pip install jq nbformat
script
:
# Récupère les fichiers JSON et IPYNB modifiés dans le commit
-
MODIFIED_JSON_FILES=$(git diff --name-only HEAD~1 HEAD | grep '\.json$' ||
true
)
-
MODIFIED_IPYNB_FILES=$(git diff --name-only HEAD~1 HEAD | grep '\.ipynb$' ||
true
)
# Si aucun fichier n'est modifié, terminer le job
-
if [ -z "$MODIFIED_JSON_FILES" ] && [ -z "$MODIFIED_IPYNB_FILES" ]; then echo "No files to format."; exit 0; fi
# 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 les modifications pour le commit (optionnel)
-
git add $MODIFIED_JSON_FILES $MODIFIED_IPYNB_FILES
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