Skip to content

Commit 29e4b39

Browse files
authored
fix: keep release green when auto PR creation is blocked (#7)
* fix: keep release green when auto PR creation is blocked * ci: skip tauri build matrix on non-code PRs * ci: grant path filter read access * fix: only ignore expected post-release PR error
1 parent 552fd8a commit 29e4b39

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,33 @@ on:
66
pull_request:
77
branches: ["main"]
88

9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
913
jobs:
14+
changes:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
tauri_build: ${{ steps.filter.outputs.tauri_build }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- id: filter
23+
uses: dorny/paths-filter@v3
24+
with:
25+
filters: |
26+
tauri_build:
27+
- 'src/**'
28+
- 'src-tauri/**'
29+
- 'package.json'
30+
- 'package-lock.json'
31+
- 'index.html'
32+
- 'vite.config.*'
33+
- 'tsconfig*.json'
34+
- 'scripts/**'
35+
1036
lint:
1137
runs-on: ubuntu-latest
1238
steps:
@@ -102,10 +128,12 @@ jobs:
102128
name: Tauri build (${{ matrix.platform.name }})
103129
runs-on: ${{ matrix.platform.os }}
104130
needs:
131+
- changes
105132
- lint
106133
- typecheck
107134
- test-js
108135
- test-tauri
136+
if: github.event_name != 'pull_request' || needs.changes.outputs.tauri_build == 'true'
109137
strategy:
110138
fail-fast: false
111139
matrix:

.github/workflows/release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,21 @@ jobs:
688688
git commit -m "chore: bump version to ${NEXT_VERSION}"
689689
git push origin "chore/bump-version-${NEXT_VERSION}"
690690
691-
gh pr create \
691+
PR_CREATE_LOG=$(mktemp)
692+
if ! gh pr create \
692693
--title "chore: bump version to ${NEXT_VERSION}" \
693694
--body "Post-release version bump to ${NEXT_VERSION}." \
694695
--base main \
695-
--head "chore/bump-version-${NEXT_VERSION}"
696+
--head "chore/bump-version-${NEXT_VERSION}" >"$PR_CREATE_LOG" 2>&1; then
697+
if grep -q "GitHub Actions is not permitted to create or approve pull requests" "$PR_CREATE_LOG"; then
698+
echo "::warning::GitHub Actions could not create the post-release PR due to repository policy. The branch chore/bump-version-${NEXT_VERSION} was pushed successfully; open the PR manually."
699+
cat "$PR_CREATE_LOG"
700+
else
701+
cat "$PR_CREATE_LOG"
702+
rm -f "$PR_CREATE_LOG"
703+
exit 1
704+
fi
705+
else
706+
cat "$PR_CREATE_LOG"
707+
fi
708+
rm -f "$PR_CREATE_LOG"

0 commit comments

Comments
 (0)