Skip to content

Commit 58b9531

Browse files
m13vclaude
andcommitted
fix: skip Chrome Web Store publish when extension unchanged
Add change detection to browser extension release workflow. Compares current tag with previous tag to check if any files in crates/terminator/browser-extension/ changed. Skips Chrome Web Store steps if no changes detected. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f2b2f02 commit 58b9531

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/publish-browser-extension.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,34 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Check if extension files changed
21+
id: changes
22+
run: |
23+
# Get the previous tag
24+
PREV_TAG=$(git tag --sort=-version:refname | grep '^v' | head -n 2 | tail -n 1)
25+
CURRENT_TAG=${GITHUB_REF#refs/tags/}
26+
27+
if [ -z "$PREV_TAG" ]; then
28+
echo "No previous tag found, assuming changes"
29+
echo "extension_changed=true" >> $GITHUB_OUTPUT
30+
exit 0
31+
fi
32+
33+
echo "Comparing $PREV_TAG to $CURRENT_TAG"
34+
35+
# Check if any extension files changed
36+
CHANGED=$(git diff --name-only "$PREV_TAG" "$CURRENT_TAG" -- crates/terminator/browser-extension/ | wc -l)
37+
38+
if [ "$CHANGED" -gt 0 ]; then
39+
echo "Extension files changed ($CHANGED files)"
40+
echo "extension_changed=true" >> $GITHUB_OUTPUT
41+
else
42+
echo "No extension files changed"
43+
echo "extension_changed=false" >> $GITHUB_OUTPUT
44+
fi
1745
1846
- name: Package extension
1947
run: |
@@ -33,6 +61,7 @@ jobs:
3361
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3462

3563
- name: Get Chrome Web Store access token
64+
if: steps.changes.outputs.extension_changed == 'true'
3665
id: cws_token
3766
run: |
3867
RESPONSE=$(curl -s -X POST https://oauth2.googleapis.com/token \
@@ -50,6 +79,7 @@ jobs:
5079
echo "[OK] Access token obtained"
5180
5281
- name: Upload to Chrome Web Store
82+
if: steps.changes.outputs.extension_changed == 'true'
5383
run: |
5484
RESPONSE=$(curl -s -X PUT \
5585
"https://www.googleapis.com/upload/chromewebstore/v1.1/items/${{ secrets.CWS_EXTENSION_ID }}" \
@@ -65,6 +95,7 @@ jobs:
6595
echo "[OK] Extension uploaded to Chrome Web Store"
6696
6797
- name: Publish to Chrome Web Store
98+
if: steps.changes.outputs.extension_changed == 'true'
6899
run: |
69100
RESPONSE=$(curl -s -X POST \
70101
"https://www.googleapis.com/chromewebstore/v1.1/items/${{ secrets.CWS_EXTENSION_ID }}/publish" \

0 commit comments

Comments
 (0)