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: Push changes to subtree | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| - name: Check out code | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Set Git identity | |
| run: | | |
| git config --global user.email "rares.lemnariu@ro.bosch.com" | |
| git config --global user.name "BFMC - Rares Lemnariu" | |
| - name: Check commit message | |
| id: commit_message | |
| run: | | |
| commit_message=$(git log -1 --pretty=%B) | |
| echo "Commit message: $commit_message" | |
| if [[ "$commit_message" == *"Traceback: FromPull"* ]]; then | |
| echo "Commit message contains 'Traceback: FromPull'. Exiting." | |
| exit 0 | |
| else | |
| # Add the commands you want to execute if the commit message does not contain "Traceback: FromPull" | |
| echo "Commit message does not contain 'Traceback: FromPull'. Proceeding with the rest of the script." | |
| # Your commands go here | |
| fi | |
| echo "passed" | |
| - name: Fetch changes from remote | |
| run: | | |
| git remote add shared git@github.com:ECC-BFMC/Shared.git | |
| git fetch shared servers | |
| git merge -s ours FETCH_HEAD | |
| - name: Add source to the commit. | |
| run: | | |
| git add servers | |
| git commit --amend -m "Traceback: project_name=Computer" | |
| - name: Push merged changes to remote servers branch | |
| run: | | |
| git subtree push --prefix=servers shared servers | |