child_updated #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update submodules when a child repo changes | |
| permissions: | |
| contents: write | |
| on: | |
| repository_dispatch: | |
| types: [child_updated] | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout portfolio repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| - name: Update submodules to latest main | |
| run: | | |
| git submodule update --remote --force | |
| - name: Commit changes | |
| run: | | |
| git add . | |
| if git diff --cached --quiet; then | |
| echo "No submodule updates" | |
| exit 0 | |
| fi | |
| git commit -m "Auto-update submodules from child repo change" | |
| - name: Push changes | |
| run: git push |