54 lines
1.6 KiB
YAML
54 lines
1.6 KiB
YAML
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
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Get head commit
|
|
run: |
|
|
export COMMIT_MESSAGE=`git log --format=%B -n 1 HEAD | head -n 1`
|
|
echo "CHECK: '${COMMIT_MESSAGE}'"
|
|
if ! [ "${COMMIT_MESSAGE/#bot-message: /""}" = "$COMMIT_MESSAGE" ]; then
|
|
echo "FOUND: '#bot-message: '"
|
|
echo "BOT_MESSAGE='true'" >> "${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 "${{ vars.CI_COMMIT_AUTHOR }}"
|
|
git config --global user.email "${{ vars.CI_COMMIT_EMAIL }}"
|
|
|
|
export CI_COMMIT_MESSAGE="${{ vars.CI_COMMIT_MESSAGE }}"
|
|
|
|
${{ github.workspace }}/home/.init/bin/mirror_project.sh "${CI_COMMIT_MESSAGE/#bot-message: /""}" ../home
|