Skip to content

Deleted unused [link-author] ↞ [auto-sync from https://github.com/a… #126

Deleted unused [link-author] ↞ [auto-sync from https://github.com/a…

Deleted unused [link-author] ↞ [auto-sync from https://github.com/a… #126

name: Sync README.md between scss-to-css/node.js/ & scss-to-css/node.js/docs/, then scss-to-css/ to adamlui/scss-to-css
on:
push:
branches: [main]
paths: [scss-to-css/**]
permissions:
contents: read
jobs:
build:
if: (github.repository == 'adamlui/js-utils') && (github.event.commits[0].committer.username != 'kudo-sync-bot')
runs-on: ubuntu-latest
env:
TZ: PST8PDT
steps:
- name: Checkout adamlui/js-utils
uses: actions/checkout@v5.0.0
with:
token: ${{ secrets.REPO_SYNC_PAT }}
path: adamlui/js-utils
fetch-depth: 2
- name: Checkout adamlui/scss-to-css
uses: actions/checkout@v5.0.0
with:
token: ${{ secrets.REPO_SYNC_PAT }}
repository: adamlui/scss-to-css
path: adamlui/scss-to-css
- name: Sync README.md between scss-to-css/node.js/ & scss-to-css/node.js/docs
run: |
cd ${{ github.workspace }}/adamlui/js-utils
# Init paths/content/mod timestamps
root_readme="./scss-to-css/node.js/README.md"
root_readme_content=$(git show HEAD:"$root_readme")
root_readme_modified=$(git log -1 --format="%ct" -- "$root_readme")
docs_readme="./scss-to-css/node.js/docs/README.md"
docs_readme_content=$(git show HEAD:"$docs_readme")
docs_readme_modified=$(git log -1 --format="%ct" -- "$docs_readme")
# Perform syncs of diff READMEs
if [[ "$root_readme_content" != "$docs_readme_content" ]] ; then
if (( $root_readme_modified > $docs_readme_modified )) ; then
cp -f "$root_readme" "$docs_readme"
echo "Copied $root_readme to $docs_readme"
src_folder="/scss-to-css/node.js"
elif (( $docs_readme_modified > $root_readme_modified )) ; then
cp -f "$docs_readme" "$root_readme"
echo "Copied $docs_readme to $root_readme"
src_folder="/scss-to-css/node.js/docs"
fi
fi
# Expose sync src for commit msg in self-push step
echo "SYNC_SRC=$src_folder" >> $GITHUB_ENV
- name: Sync scss-to-css/ to adamlui/scss-to-css/
run: |
rsync -avhr --delete --filter='P /.*' \
${{ github.workspace }}/adamlui/js-utils/scss-to-css/ \
${{ github.workspace }}/adamlui/scss-to-css/
- 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
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_ID: ${{ secrets.GPG_PRIVATE_ID }}
run: |
gpg --batch --import <(echo "$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 "$GPG_PRIVATE_ID"
- name: Push changes to adamlui/js-utils
if: env.SYNC_SRC
run: |
cd ${{ github.workspace }}/adamlui/js-utils
git pull && git add .
git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from $SYNC_SRC]" || true
git push
- name: Push changes to adamlui/scss-to-css
run: |
cd ${{ github.workspace }}/adamlui/scss-to-css
git pull && git add .
git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from https://github.com/adamlui/js-utils/tree/main/scss-to-css]" || true
git push