Accept Gitea's trailing-slash server URL in the deploy guard
Gitea evaluates job conditions with its ROOT_URL, https://git.waozi.xyz/, so the exact comparison skipped the deploy job after every gate passed. The runtime check in the deploy job strips the same trailing slash.
This commit is contained in:
1 parent
12226b595b
commit
b4ea4c2399
2 files changed
+4
-3
No files matched your search
@@ -254,7 +254,7 @@ jobs:
|
||||
deploy:
|
||||
needs: [checks, container]
|
||||
if: >-
|
||||
github.server_url == 'https://git.waozi.xyz' &&
|
||||
(github.server_url == 'https://git.waozi.xyz' || github.server_url == 'https://git.waozi.xyz/') &&
|
||||
github.repository == 'ziranlang/mesh' && github.ref == 'refs/heads/master' &&
|
||||
(github.event_name == 'push' || github.event_name == 'workflow_dispatch') &&
|
||||
vars.MESH_DEPLOY_READY == 'true' && vars.MESH_DEPLOY_RUNNER != ''
|
||||
@@ -265,7 +265,7 @@ jobs:
|
||||
steps:
|
||||
- name: Verify canonical deployment context
|
||||
run: |
|
||||
test "$GITHUB_SERVER_URL" = https://git.waozi.xyz
|
||||
test "${GITHUB_SERVER_URL%/}" = https://git.waozi.xyz
|
||||
test "$GITHUB_REPOSITORY" = ziranlang/mesh
|
||||
test "$GITHUB_REF" = refs/heads/master
|
||||
case "$GITHUB_EVENT_NAME" in push|workflow_dispatch) ;; *) exit 1 ;; esac
|
||||
|
||||
@@ -35,7 +35,8 @@ class GiteaWorkflowTest(unittest.TestCase):
|
||||
self.assertEqual(set(deploy["needs"]), REQUIRED_JOBS)
|
||||
self.assertEqual(set(self.jobs), REQUIRED_JOBS | {"deploy"})
|
||||
for guard in (
|
||||
"github.server_url == 'https://git.waozi.xyz'",
|
||||
# Gitea evaluates job conditions with its ROOT_URL, which ends in a slash.
|
||||
"(github.server_url == 'https://git.waozi.xyz' || github.server_url == 'https://git.waozi.xyz/')",
|
||||
"github.repository == 'ziranlang/mesh'",
|
||||
"github.ref == 'refs/heads/master'",
|
||||
"(github.event_name == 'push' || github.event_name == 'workflow_dispatch')",
|
||||
|
||||
Reference in new issue
Block a user