Skip to content

Commit

Permalink
split workflow; checkout create-preview-links from trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicente Canales committed Apr 27, 2024
1 parent 3acd95b commit a111ecf
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/preview-theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Preview Theme Changes
on:
pull_request_target:
types: [opened, synchronize]
permissions:
pull-requests: write

jobs:
check-for-changes-to-themes:
Expand Down Expand Up @@ -43,10 +45,21 @@ jobs:
echo "HAS_THEME_CHANGES=true" >> $GITHUB_OUTPUT
echo "CHANGED_THEMES=$(echo ${unique_dirs[@]})" >> $GITHUB_ENV
echo "Theme directories with changes: $CHANGED_THEMES"
handle-pr-comment:
runs-on: ubuntu-latest
needs: check-for-changes-to-themes
steps:
- name: Checkout create-preview-links script from trunk
uses: actions/checkout@v2
with:
repository: Automattic/themes
path: .github/scripts
ref: trunk

- name: Add Preview Links comment
id: comment-on-pr
if: ${{ steps.check-for-changes.outputs.HAS_THEME_CHANGES == 'true' }}
if: ${{ needs.check-for-changes-to-themes.outputs.HAS_THEME_CHANGES == 'true' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -55,7 +68,7 @@ jobs:
createPreviewLinks(github, context, process.env.CHANGED_THEMES);
- name: Remove comment if no changes are detected
if: ${{ steps.check-for-changes.outputs.HAS_THEME_CHANGES == 'false' }}
if: ${{ needs.check-for-changes-to-themes.outputs.HAS_THEME_CHANGES == 'false' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -75,4 +88,4 @@ jobs:
repo: context.repo.repo
});
}

0 comments on commit a111ecf

Please sign in to comment.