Skip to content

Commit

Permalink
Revert "Use pull_request_target to avoid token restriction (#169)" (#170
Browse files Browse the repository at this point in the history
)

This reverts commit c131d44.
  • Loading branch information
vcanales authored Apr 29, 2024
1 parent c131d44 commit e0cbfbb
Showing 1 changed file with 3 additions and 8 deletions.
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

0 comments on commit e0cbfbb

Please sign in to comment.