mehrancodes / laravel-harbor

a cli tool to Quickly create on-demand preview environment for your app on Laravel Forge.
https://www.laravel-harbor.com
MIT License
76 stars 7 forks source link

Teardown shows 'FAIL ---> Site not found.', but the site exists #115

Open 54853315 opened 2 months ago

54853315 commented 2 months ago

I noticed that there are undeleted preview sites in Forge. Immediately checking the execution logs of Actions shows: FAIL ---> Site not found.

QQ_1726648762438

preview-teardown.yml

name: preview-teardown
on:
  pull_request:
    branches: [dev]
    types: [closed]
jobs:
  harbor-teardown:
    if: |
      github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    container:
      image: kirschbaumdevelopment/laravel-test-runner:8.1
    steps:
      - name: Set FORGE_SUBDOMAIN_PATTERN if head_ref starts with 't'
        if: startsWith(github.head_ref, 't')
        run: echo "FORGE_SUBDOMAIN_PATTERN=/^(t\d{3,8})-(?:.*-.*)/i" >> $GITHUB_ENV
      - name: Install Harbor
        run: composer global require mehrancodes/laravel-harbor -q
      - name: Start Teardown Preview Site
        env:
          FORGE_TOKEN: ${{ secrets.FORGE_API_TOKEN }}
          FORGE_SERVER: ${{ secrets.FORGE_DEV_SERVER_ID }}
          FORGE_GIT_REPOSITORY: ${{ github.repository }}
          FORGE_GIT_BRANCH: ${{ github.head_ref }}
          FORGE_DOMAIN: domain.com
        run: |
          harbor teardown

Please note that my laravel-harbor usesFORGE_SUBDOMAIN_PATTERN to determine the subdomain style based on the branch name:

QQ_1726648839934

In the :Start Teardown Preview Site step, when printing the environment variables, FORGE_SUBDOMAIN_PATTERN appears, indicating that the condition in the above step: Set FORGE_SUBDOMAIN_PATTERN if head_ref starts with 't' is met. Therefore, a FORGE_SUBDOMAIN_PATTERN is inserted into GitHub's environment variables to ensure the correct subdomain can be found during the teardown phase.

QQ_1726648256423


So I simulated the content of this Pull Request locally and executed it using theact tool. Surprisingly, it executed successfully!

I'm not sure if this is a bug related to the subdomain?

QQ_1726648984669

QQ_1726648953661

dev-anthonyrae commented 1 week ago

I have a related / similar issue with the site directory not being removed https://github.com/mehrancodes/laravel-harbor/issues/114