Skip to content

Commit f420d51

Browse files
committed
chore(ci): action
1 parent 58eff1d commit f420d51

1 file changed

Lines changed: 16 additions & 41 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ permissions:
1313
contents: read
1414
pages: write
1515
id-token: write
16+
pull-requests: read
1617

1718
concurrency:
1819
group: 'pages'
@@ -22,55 +23,29 @@ jobs:
2223
check_changes:
2324
runs-on: ubuntu-latest
2425
outputs:
25-
should_build: ${{ steps.check.outputs.should_build }}
26+
should_build: ${{ steps.filter.outputs.should_build }}
2627
steps:
2728
- name: Checkout
2829
uses: actions/checkout@v4
2930
with:
30-
fetch-depth: 0
31+
fetch-depth: 50
3132

32-
- name: Check for changes
33-
id: check
34-
run: |
35-
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
36-
echo "Workflow manually triggered, proceeding with build"
37-
echo "should_build=true" >> $GITHUB_OUTPUT
38-
exit 0
39-
fi
40-
41-
# For workflow_run events
42-
echo "Checking for changes in .stories.tsx files, .storybook, or landing directory"
43-
44-
# Get the main branch
45-
git fetch origin master
46-
47-
# Debug information
48-
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
49-
echo "Current commit: $(git rev-parse HEAD)"
50-
echo "Master commit: $(git rev-parse origin/master)"
51-
52-
# Check changes on the branch compared directly to master
53-
# Using double dots (..) to show differences between branches
54-
ALL_CHANGES=$(git diff --name-only origin/master..HEAD)
55-
echo "All changes detected:"
56-
echo "$ALL_CHANGES"
57-
58-
# Filter for relevant changes
59-
CHANGES=$(echo "$ALL_CHANGES" | grep -E '\.stories\.tsx$|^landing/|^\.storybook/' || true)
60-
61-
if [ ! -z "$CHANGES" ]; then
62-
echo "Changes detected in .stories.tsx files, .storybook directory, or landing directory:"
63-
echo "$CHANGES"
64-
echo "should_build=true" >> $GITHUB_OUTPUT
65-
else
66-
echo "No changes detected in .stories.tsx files, .storybook directory, or landing directory"
67-
echo "should_build=false" >> $GITHUB_OUTPUT
68-
fi
33+
- name: Filter changes
34+
uses: dorny/paths-filter@v3
35+
id: filter
36+
with:
37+
filters: |
38+
should_build:
39+
- '.stories.tsx'
40+
- 'landing/**'
41+
- '.storybook/**'
42+
- 'package.json'
43+
- 'landing/package.json'
6944
7045
build:
7146
runs-on: ubuntu-latest
7247
needs: check_changes
73-
if: needs.check_changes.outputs.should_build == 'true' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success')
48+
if: needs.check_changes.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch'
7449
steps:
7550
- name: Checkout
7651
uses: actions/checkout@v4
@@ -85,7 +60,7 @@ jobs:
8560

8661
- name: Restore Bun cache
8762
uses: actions/cache@v4
88-
id: bun-cache # Give it an id to check if cache was hit later if needed
63+
id: bun-cache
8964
with:
9065
path: ~/.bun/install/cache
9166
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}

0 commit comments

Comments
 (0)