|
| 1 | +name: "Testing action-platformsh-url" |
| 2 | + |
| 3 | +on: pull_request |
| 4 | +permissions: write-all |
| 5 | + |
| 6 | +jobs: |
| 7 | + ok-test: |
| 8 | + name: "Testing on a branch that has an active, deployed environment" |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v2 |
| 12 | + |
| 13 | + - uses: ./ |
| 14 | + with: |
| 15 | + PLATFORMSH_ID: ${{ secrets.TEST_PLATFORMSH_ID }} |
| 16 | + PLATFORMSH_KEY: ${{ secrets.TEST_PLATFORMSH_KEY }} |
| 17 | + ENVIRONMENT_NAME: main |
| 18 | + |
| 19 | + fail-deploy-test: |
| 20 | + name: "Testing on a environment that has a failed deployment" |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - uses: ./ |
| 26 | + id: inactive_url |
| 27 | + continue-on-error: true |
| 28 | + with: |
| 29 | + PLATFORMSH_ID: ${{ secrets.TEST_PLATFORMSH_ID }} |
| 30 | + PLATFORMSH_KEY: ${{ secrets.TEST_PLATFORMSH_KEY }} |
| 31 | + ENVIRONMENT_NAME: main |
| 32 | + DEPLOY_STATUS_PATH: '/sites/default/files/mock-deploy-status' |
| 33 | + |
| 34 | + - name: Check for failure |
| 35 | + if: ${{ steps.inactive_url.outputs.url }} |
| 36 | + uses: actions/github-script@v3 |
| 37 | + with: |
| 38 | + script: | |
| 39 | + core.setFailed('The test did not fail as expected.') |
| 40 | +
|
| 41 | +
|
| 42 | + missing-url-test: |
| 43 | + name: "Testing on a environment that that has no URL" |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v2 |
| 47 | + |
| 48 | + - uses: ./ |
| 49 | + id: missing_url |
| 50 | + continue-on-error: true |
| 51 | + with: |
| 52 | + PLATFORMSH_ID: ${{ secrets.TEST_PLATFORMSH_ID }} |
| 53 | + PLATFORMSH_KEY: ${{ secrets.TEST_PLATFORMSH_KEY }} |
| 54 | + ENVIRONMENT_NAME: main |
| 55 | + DEPLOY_STATUS_PATH: '/sites/default/files/xxx-deploy-status' |
| 56 | + |
| 57 | + - name: Check for failure |
| 58 | + if: ${{ steps.missing_url.outputs.url }} |
| 59 | + uses: actions/github-script@v3 |
| 60 | + with: |
| 61 | + script: | |
| 62 | + core.setFailed('The test did not fail as expected.') |
0 commit comments