name: Sync Repository Kompose via git on: workflow_dispatch: # Allows workflow to be run manually push: branches: - main # Or your default branch paths: - 'Projects/kompose/**' env: BOT_MESSAGE: true jobs: check: runs-on: ubuntu-latest permissions: id-token: write contents: read pull-requests: read steps: - name: Get commits env: COMMIT_MESSAGE: ${{ github.event.head_commit.message }} run: | echo "CHECK: '${{ COMMIT_MESSAGE }}'" if [[ "${{ env.COMMIT_MESSAGE }}" == "#bot-message: *" ]]; then echo "FOUND: '#bot-message: '" echo "BOT_MESSAGE=${BOT_MESSAGE}" >> "${GITHUB_ENV}" else echo "NOT FOUND: '#bot-message: '" echo 'BOT_MESSAGE=' >> "${GITHUB_ENV}" fi build: runs-on: ubuntu-latest if: ${{ vars.BOT_MESSAGE == 'true' }} steps: - uses: actions/checkout@v4 with: path: home - uses: actions/checkout@v4 with: repository: valknar/kompose ref: main path: kompose - name: Commit and push changes (if any) shell: bash env: CI_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}" CI_COMMIT_AUTHOR: technitz[bot]@valknar/kompose CI_COMMIT_EMAIL: admin@pivoine.art run: | cd kompose git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" export CI_COMMIT_MESSAGE="${{ env.CI_COMMIT_MESSAGE }}" ${{ github.workspace }}/home/.init/bin/mirror_project.sh "${CI_COMMIT_MESSAGE/#bot-message: /""}" ../home