Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update, to better detect deployments. #16

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
PLATFORMSH_ID: ${{ secrets.TEST_PLATFORMSH_ID }}
PLATFORMSH_KEY: ${{ secrets.TEST_PLATFORMSH_KEY }}
ENVIRONMENT_NAME: main
ENVIRONMENT_NAME: master
ALLOW_CANCEL_CRON: 1

missing-test:
Expand All @@ -34,7 +34,7 @@ jobs:
DEPLOY_WAIT_TIME: 10

- name: Check for failure
if: ${{ steps.inactive_url.outputs.url }}
if: ${{ steps.missing_url.outputs.url }}
uses: actions/github-script@v3
with:
script: |
Expand All @@ -52,7 +52,7 @@ jobs:
with:
PLATFORMSH_ID: ${{ secrets.TEST_PLATFORMSH_ID }}
PLATFORMSH_KEY: ${{ secrets.TEST_PLATFORMSH_KEY }}
ENVIRONMENT_NAME: inactive
ENVIRONMENT_NAME: pr-462
DEPLOY_WAIT_TIME: 30

- name: Check for failure
Expand Down
18 changes: 9 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ inputs:
required: false
type: string

DEPLOYMENT_TYPE_EXCLUDES:
description: "Types of deployments NOT to wait for. Default: environment.cron - See types here: https://docs.platform.sh/integrations/activity/reference.html#type"
default: "environment.cron"
required: false
ACTIVITY_TYPES:
description: "Types of deployments to wait for. Default: push - See types here: https://docs.platform.sh/integrations/activity/reference.html#type"
default: "push"
required: true
type: string

DEPLOY_WAIT_TIME:
description: "How many seconds should we maximum wait for the deploy to work? If the branch doesnt exist in the PlatformSH GIT Remote, this is how long the action will take. Actually inactive environments get detected instantly. Default: 1000 seconds."
default: 1000
PSH_DETECTION_WAIT:
description: "How long should we maximum wait for PSH to detect the push? If the branch doesnt exist in the PlatformSH GIT Remote, this is how long the action will take. Actually inactive environments get detected instantly. Default: 120 seconds."
default: 120
required: false
type: integer

Expand Down Expand Up @@ -76,12 +76,12 @@ runs:
SUCCESS=0

DELAY_BETWEEN_ATTEMPTS=5;
MAX_SECONDS=${{ inputs.DEPLOY_WAIT_TIME }};
MAX_SECONDS=${{ inputs.PSH_DETECTION_WAIT }};
MAX_TRIES=$(( MAX_SECONDS / DELAY_BETWEEN_ATTEMPTS ));

while [ $TRIES -le $MAX_TRIES ]; do \
TRIES=$((TRIES+1)); \
ACTS=$(~/.platformsh/bin/platform activities --columns=state --incomplete --no-header --format=plain --no-interaction --exclude-type=${{ inputs.DEPLOYMENT_TYPE_EXCLUDES }} 2>&1 || true); \
ACTS=$(~/.platformsh/bin/platform activities --columns=state --incomplete --no-header --format=plain --no-interaction --type=${{ inputs.ACTIVITY_TYPES }} 2>&1 || true); \
if [[ "$ACTS" =~ "Specified environment not found" ]]; then break; fi; \
if [[ "$ACTS" =~ "Exception]" ]]; then break; fi; \
if [[ "$ACTS" =~ "No activities found" ]]; then SUCCESS=1; break; fi; \
Expand Down
Loading