Skip to content

Commit 53dec98

Browse files
refactor: Simplify release router workflow by removing unnecessary switch job and consolidating secret inheritance
1 parent ce88a18 commit 53dec98

File tree

1 file changed

+4
-40
lines changed

1 file changed

+4
-40
lines changed

.github/workflows/router.yaml

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,12 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
switch:
12-
runs-on: ubuntu-latest
13-
outputs:
14-
target: ${{ steps.route.outputs.target }}
15-
steps:
16-
- name: Route release
17-
id: route
18-
run: |
19-
HEAD_REPO="${{ github.event.pull_request.head.repo.full_name }}"
20-
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" && "${GITHUB_REF##*/}" == "main" ]]; then
21-
echo "target=latest" >> $GITHUB_OUTPUT
22-
# only run on all pushes or pull requests from forks
23-
elif [[ "$GITHUB_EVENT_NAME" == "push" ]] || [[ "$HEAD_REPO" != "$GITHUB_REPOSITORY" ]]; then
24-
echo "target=feature" >> $GITHUB_OUTPUT
25-
else
26-
echo "target=skip" >> $GITHUB_OUTPUT
27-
fi
28-
2911
run-feature:
30-
needs: switch
31-
if: needs.switch.outputs.target == 'feature'
12+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
3213
uses: ./.github/workflows/release-feature-branch.yaml
33-
secrets:
34-
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
35-
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
36-
NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
37-
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
38-
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
39-
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
40-
LIBSQL_REMOTE_URL: ${{ secrets.LIBSQL_REMOTE_URL }}
41-
LIBSQL_REMOTE_TOKEN: ${{ secrets.LIBSQL_REMOTE_TOKEN }}
14+
secrets: inherit
4215

4316
run-latest:
44-
needs: switch
45-
if: needs.switch.outputs.target == 'latest'
17+
if: github.event_name == 'workflow_dispatch' && github.ref_name == 'main'
4618
uses: ./.github/workflows/release-latest.yaml
47-
secrets:
48-
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
49-
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
50-
NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
51-
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
52-
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
53-
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
54-
LIBSQL_REMOTE_URL: ${{ secrets.LIBSQL_REMOTE_URL }}
55-
LIBSQL_REMOTE_TOKEN: ${{ secrets.LIBSQL_REMOTE_TOKEN }}
19+
secrets: inherit

0 commit comments

Comments
 (0)