Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert changes in preview-themes workflow #170

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .github/workflows/preview-theme.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
name: Preview Theme Changes

on:
pull_request_target:
types: [opened, synchronize]
pull_request:

jobs:
check-for-changes-to-themes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Retrieved Theme Changes
id: check-for-changes
run: |
# Retrieve list of all changed files
git fetch origin
git fetch origin trunk:trunk
changed_files=$(git diff --name-only HEAD origin/trunk)

# Loop through changed files and identify parent directories
Expand All @@ -37,13 +34,12 @@ jobs:
if [[ ${#unique_dirs[@]} -eq 0 ]]; then
echo "No theme changes detected"
echo "HAS_THEME_CHANGES=false" >> $GITHUB_OUTPUT
exit 0
exit 0 # Use exit code 0 for successful completion
fi
# Output list of theme slugs with changes
echo "HAS_THEME_CHANGES=true" >> $GITHUB_OUTPUT
echo "CHANGED_THEMES=$(echo ${unique_dirs[@]})" >> $GITHUB_ENV
echo "Theme directories with changes: $CHANGED_THEMES"

- name: Add Preview Links comment
id: comment-on-pr
if: ${{ steps.check-for-changes.outputs.HAS_THEME_CHANGES == 'true' }}
Expand All @@ -53,7 +49,6 @@ jobs:
script: |
const createPreviewLinks = require('.github/scripts/create-preview-links');
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' }}
uses: actions/github-script@v7
Expand Down
Loading