2023-01-31 23:33:07 +01:00
name : Sync with shadow repo
on :
push :
create :
delete :
pull_request :
types : [ opened]
concurrency :
group : ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress : true
jobs :
sync-branch :
name : Create/delete shadow branch
runs-on : ubuntu-latest
if : github.event.ref_type == 'branch'
steps :
- name : Clone shadow repo
uses : actions/checkout@v3
with :
2023-01-31 23:42:59 +01:00
repository : ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}
2023-01-31 23:33:07 +01:00
ssh-key : ${{ secrets.SHADOW_REPO_PRIVATE_KEY }}
ref : main
- name : Create branch on shadow repo
if : github.event_name == 'create'
run : git push origin main:${{ github.event.ref }}
- name : Delete branch on shadow repo
if : github.event_name == 'delete'
run : git push origin --delete ${{ github.event.ref }}
push-branch :
name : Push to shadow branch
runs-on : ubuntu-latest
if : github.event_name == 'push'
steps :
- uses : actions/checkout@v3
- uses : actions/setup-node@v3
with :
node-version-file : .nvmrc
2023-06-20 00:12:39 +02:00
cache : npm
- run : npm ci
- run : npm run build-prod
2023-01-31 23:33:07 +01:00
- name : Clone shadow repo
uses : actions/checkout@v3
with :
2023-01-31 23:45:08 +01:00
repository : ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}
2023-01-31 23:33:07 +01:00
ssh-key : ${{ secrets.SHADOW_REPO_PRIVATE_KEY }}
ref : ${{ github.ref_name }}
path : shadow-repo
- name : Push to shadow branch
run : |
cd shadow-repo
rm -rf ./*
cp -rT ../_site .
2023-06-22 22:34:15 +02:00
- uses : EndBug/add-and-commit@v9
with :
cwd : shadow-repo
author_name : Sass Bot
author_email : sass.bot.beep.boop@gmail.com
message : Update from https://github.com/${{ github.repository }}/commit/${{ github.sha }}
commit : --allow-empty
2023-01-31 23:33:07 +01:00
diff-link :
name : Create comment to diff link
runs-on : ubuntu-latest
if : github.event_name == 'pull_request' && github.event.action == 'opened'
steps :
- uses : peter-evans/create-or-update-comment@v2
with :
issue-number : ${{ github.event.number }}
body : |
2023-01-31 23:45:08 +01:00
View diff of compiled files (may take a few minutes) : https://github.com/${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}/compare/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.ref }}