Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .github/workflows/update libs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update library list
name: Check library list
permissions:
contents: write
pull-requests: write
Expand All @@ -8,7 +8,7 @@ on:
types: [ opened, synchronize ]

jobs:
update-library-list:
check-library-list:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -42,21 +42,36 @@ jobs:
chmod +x generateLibraryList.bash
./generateLibraryList.bash

- name: Add changes to Git
- name: Check for changes
id: diff
if: steps.changes.outputs.packageJson == 'true'
run: |
git config core.fileMode false
git diff -w --ignore-blank-lines
echo "CHANGES=$(( $(git diff -w --ignore-blank-lines | wc -l) > 0 ? 1 : 0 ))" >> $GITHUB_OUTPUT

- name: Add changes to Git
if: steps.changes.outputs.packageJson == 'true' && steps.diff.outputs.CHANGES == 1 && github.event.pull_request.head.repo.full_name == github.repository
run: |
git add -A

- name: Commit changes
if: steps.changes.outputs.packageJson == 'true'
if: steps.changes.outputs.packageJson == 'true' && steps.diff.outputs.CHANGES == 1 && github.event.pull_request.head.repo.full_name == github.repository
run: |
git config --local user.name "GitHub Action"
git config --local user.email "action@github.com"
git commit -m "docs: update library list" || echo "No changes to commit"

- name: Push changes
if: steps.changes.outputs.packageJson == 'true'
if: steps.changes.outputs.packageJson == 'true' && steps.diff.outputs.CHANGES == 1 && github.event.pull_request.head.repo.full_name == github.repository
run: git push origin HEAD:${{ github.head_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Fork detected
if: steps.changes.outputs.packageJson == 'true' && steps.diff.outputs.CHANGES == 1 && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "La liste des dépendances doit être mise à jour."
echo "A cause d'une limitation de GitHub Actions, il est impossible de mettre à jour la liste des dépendances depuis un fork."
echo "Merci d'exécuter le script 'generateLibraryList.bash' de votre côté."
exit 1