Created
December 15, 2022 12:52
-
-
Save achisholm/2d1f1379792964c346d5db36a9b1d4b0 to your computer and use it in GitHub Desktop.
Revisions
-
achisholm created this gist
Dec 15, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ name: Create Netlify deploy preview links on: pull_request: types: - opened paths: - 'dev/**/*.html' - 'dev/**/*.htm' jobs: create-deploy-preview-links: runs-on: ubuntu-latest steps: - name: Check out repository code uses: actions/checkout@v3 with: fetch-depth: 0 - name: Post a list of Netlify preview URLs to the raised pull request run: | # Build a list of changed HTML files in /dev & post a comment to the PR pr_number=$(echo $GITHUB_REF | cut -f3 -d/) for file in $(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -E "^dev.*\.html?$" | sed "s/^dev\///g") do echo "https://${GITHUB_HEAD_REF}--tlc-dev.netlify.app/$file" done | gh pr comment $pr_number --body-file - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}