Fix diff link comment (#768)

This commit is contained in:
Jennifer Thakar 2023-07-07 17:50:24 -07:00 committed by GitHub
parent 063d1651d3
commit 8780d2cb7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 13 deletions

View File

@ -28,13 +28,18 @@ jobs:
name: site
path: site.tar
diff-link:
name: Comment
prep-diff-link:
name: Prep comment
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'opened'
steps:
- uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.number }}
body: |
- name: Save comment
env:
COMMENT: |
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 }}
run: |
echo $COMMENT > ./comment.txt
- uses: actions/upload-artifact@v3
with:
name: comment
path: comment.txt

View File

@ -45,27 +45,49 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_run'
steps:
- name: Clone shadow repo
uses: actions/checkout@v3
with:
repository: ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}
token: ${{ secrets.SASS_SITE_TOKEN }}
ref: ${{ github.ref_name }}
path: shadow-repo
- name: Download built site
uses: dawidd6/action-download-artifact@v2.27.0
with:
name: site
run_id: ${{ github.event.workflow_run.id }}
if_no_artifact_found: ignore
- name: Clone shadow repo
uses: actions/checkout@v3
if: steps.download_comment.outputs.found_artifact == 'true'
with:
repository: ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}
token: ${{ secrets.SASS_SITE_TOKEN }}
ref: ${{ github.ref_name }}
path: shadow-repo
- name: Update shadow repo files
if: steps.download_comment.outputs.found_artifact == 'true'
run: |
rm -rf shadow_repo/*
tar xf site.tar
cp -rT _site shadow_repo
- uses: EndBug/add-and-commit@v9
if: steps.download_comment.outputs.found_artifact == 'true'
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
diff-link:
name: Comment
runs-on: ubuntu-latest
if: github.event_name == 'workflow_run'
steps:
- name: Download comment text
id: download_comment
uses: dawidd6/action-download-artifact@v2.27.0
with:
name: comment
run_id: ${{ github.event.workflow_run.id }}
if_no_artifact_found: ignore
- uses: peter-evans/create-or-update-comment@v3
if: steps.download_comment.outputs.found_artifact == 'true'
with:
issue-number: ${{ github.event.number }}
body_path: comment.txt