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 github/github-widescreen/ to adamlui/github-widescreen/greasemonkey/ | |
on: | |
push: | |
branches: [master] | |
paths: [github/github-widescreen/**] | |
jobs: | |
build: | |
if: (github.repository == 'adamlui/userscripts') && (github.event.commits[0].committer.username != 'kudo-sync-bot') | |
runs-on: ubuntu-latest | |
env: | |
TZ: PST8PDT | |
steps: | |
- name: Checkout adamlui/userscripts | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_SYNC_PAT }} | |
repository: adamlui/userscripts | |
path: adamlui/userscripts | |
- name: Checkout adamlui/github-widescreen | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_SYNC_PAT }} | |
repository: adamlui/github-widescreen | |
path: adamlui/github-widescreen | |
- name: Sync github/github-widescreen/docs/ to adamlui/github-widescreen/docs/ | |
run: | | |
cp -r -f -v \ | |
${{ github.workspace }}/adamlui/userscripts/github/github-widescreen/docs \ | |
${{ github.workspace }}/adamlui/github-widescreen/ | |
- name: Sync github/github-widescreen/ to adamlui/github-widescreen/greasemonkey/ | |
run: | | |
rsync -avhr --delete \ | |
${{ github.workspace }}/adamlui/userscripts/github/github-widescreen/ \ | |
${{ github.workspace }}/adamlui/github-widescreen/greasemonkey/ | |
- name: Escape backticks in commit msg | |
env: | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |
run: | | |
echo "ESCAPED_MSG<<EOF" >> $GITHUB_ENV | |
echo "$COMMIT_MSG" | sed 's/`/\`/g' >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Config committer | |
run: | | |
gpg --batch --import <(echo "${{ secrets.GPG_PRIVATE_KEY }}") | |
git config --global commit.gpgsign true | |
git config --global user.name "kudo-sync-bot" | |
git config --global user.email "auto-sync@kudoai.com" | |
git config --global user.signingkey "${{ secrets.GPG_PRIVATE_ID }}" | |
- name: Push changes to adamlui/github-widescreen | |
run: | | |
cd ${{ github.workspace }}/adamlui/github-widescreen | |
git add . | |
git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from \`adamlui/userscripts\`]" || true | |
git push |