refactor: use node v22, refactor permission checks (#99) #29
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: Sync repo to skyhelper-jobs repo (locales and spirits data) | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "locales/**" | |
- "src/bot/libs/constants/spirits-datas/**" | |
workflow_dispatch: | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v4 | |
with: | |
path: source | |
- name: Checkout jobs repo | |
uses: actions/checkout@v4 | |
with: | |
repository: "imnaiyar/skyhelper-jobs" | |
token: ${{secrets.PERSONAL_TOKEN}} | |
path: jobs | |
- name: Set up Git user | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Copy folders to the jobs repo | |
run: | | |
rsync -a --delete source/locales/ jobs/locales/ | |
rsync -a --delete source/src/bot/libs/constants/spirits-datas/ jobs/src/constants/spirits-datas/ | |
- name: Commit and push changes | |
env: | |
COMMIT_MSG: ${{github.event.head_commit.message}} | |
run: | | |
cd jobs | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m "Sync: '$COMMIT_MSG'" -m "Triggered by changes made in this commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }}" | |
git push | |
else | |
echo "No changes detected" | |
fi |