push-subtree #34
This file contains 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 Repository | |
on: | |
repository_dispatch: | |
types: [push-subtree] | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout nvim repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Clone dotfiles repo | |
run: | | |
git clone https://github.com/etherbiswas/dotfiles.git dotfiles | |
- name: Configure Git for dotfiles | |
run: | | |
cd dotfiles | |
git config user.name "GitHub Actions" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Pull latest .config/nvim from dotfiles | |
run: | | |
cd dotfiles | |
git pull origin hyprland | |
git subtree pull --prefix=.config/nvim https://github.com/etherbiswas/nvim.git lazy.nvim --squash | |
- name: Get the last commit message from dotfiles | |
id: commit_message | |
run: | | |
cd dotfiles | |
COMMIT_MSG=$(git log -1 --pretty=%B) | |
echo "commit_message=$COMMIT_MSG" >> $GITHUB_ENV | |
- name: Merge updates into nvim repo | |
run: | | |
rsync -av dotfiles/.config/nvim/ ./ | |
rm -rf dotfiles | |
git add . | |
git commit -m "${{ env.commit_message }}" || echo "No changes to commit" | |
git push origin lazy.nvim |