Skip to content

Commit

Permalink
Merge pull request #23 from arnested/misc
Browse files Browse the repository at this point in the history
Misc improvements
  • Loading branch information
arnested authored Aug 16, 2024
2 parents 116c4bc + a7096cf commit 6e49578
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 23 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 2

updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
time: '04:00'
timezone: Europe/Copenhagen
open-pull-requests-limit: 20
37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Lint
on: pull_request

# Detect if this action is already running, and cancel it.
# This most likely happened because a second push has been made to a branch.
concurrency:
group: ${{ github.repository_id }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
actionlint:
name: GitHub Actions
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-actionlint@v1
markdownlint:
name: Markdown
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run markdownlint
uses: DavidAnson/markdownlint-cli2-action@v16
yamllint:
name: YAML
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run Yamllint
uses: frenck/[email protected]
with:
strict: true
15 changes: 8 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: "Testing action-platformsh-url"

on: pull_request
Expand All @@ -8,7 +9,7 @@ jobs:
name: "Testing on a branch that has an active environment"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: ./
id: active_url
Expand All @@ -22,7 +23,7 @@ jobs:
name: "Testing on a branch that does not exist"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: ./
id: missing_url
Expand All @@ -31,11 +32,11 @@ jobs:
PLATFORMSH_ID: ${{ secrets.TEST_PLATFORMSH_ID }}
PLATFORMSH_KEY: ${{ secrets.TEST_PLATFORMSH_KEY }}
ENVIRONMENT_NAME: nonexistent
DEPLOY_WAIT_TIME: 10
PSH_DETECTION_WAIT: 10

- name: Check for failure
if: ${{ steps.missing_url.outcome != 'failure' }}
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
script: |
core.setFailed('The test did not fail as expected.')
Expand All @@ -44,7 +45,7 @@ jobs:
name: "Testing on a branch that used to exist"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: ./
id: inactive_url
Expand All @@ -53,11 +54,11 @@ jobs:
PLATFORMSH_ID: ${{ secrets.TEST_PLATFORMSH_ID }}
PLATFORMSH_KEY: ${{ secrets.TEST_PLATFORMSH_KEY }}
ENVIRONMENT_NAME: pr-462
DEPLOY_WAIT_TIME: 30
PSH_DETECTION_WAIT: 30

- name: Check for failure
if: ${{ steps.inactive_url.outcome != 'failure' }}
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
script: |
core.setFailed('The test did not fail as expected.')
14 changes: 14 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
extends: default

rules:
indentation:
spaces: 2
line-length: disable
truthy:
check-keys: false
braces:
min-spaces-inside: 1
max-spaces-inside: 1
min-spaces-inside-empty: 0
max-spaces-inside-empty: 0
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
# action-platformsh-url

Detecting if PlatformSH is building an environment, and returning the URL when it's done deploying.
Detecting if PlatformSH is building an environment, and returning the
URL when it's done deploying.

## Inputs

- `PLATFORMSH_ID`: The ID of your platform project.
- `PLATFORMSH_KEY`: The API token, generated through PlatformSH.
- Login to [console.platform.sh](https://console.platform.sh)
- "My Profile" > "API Tokens" > "Create API token"
- Remember that this is an access token, and **should not be written in plain text.**
- Add it as an encrypted repo secret - [more info at GitHub docs](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository).
- Login to [console.platform.sh](https://console.platform.sh)
- "My Profile" > "API Tokens" > "Create API token"
- Remember that this is an access token, and **should not be written
in plain text.**
- Add it as an encrypted repo secret - [more info at GitHub
docs](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository).
- `ENVIRONMENT_NAME` (optional): The environment, to check for
- By default, this is set to the `pr-xx`, using `pr-${{ github.event.pull_request.number }}`
- You can also set it to check for the current branch, using `${{ github.head_ref || github.ref_name }}`
- By default, this is set to the `pr-xx`, using `pr-${{
github.event.pull_request.number }}`
- You can also set it to check for the current branch, using `${{
github.head_ref || github.ref_name }}`

See the other inputs in [action.yml](action.yml)

## See also

This action is used for another action, for detecting if a platformsh environment has deployed correctly.

https://github.com/rasben/action-platformsh-deploy-status
This action is used for another action, for detecting if a platformsh
environment has deployed correctly.

<https://github.com/rasben/action-platformsh-deploy-status>
8 changes: 2 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: "Platform.sh - Get Environment URL"
description: "Detecting if PlatformSH is building an environment, and returning the URL when it's done deploying."
branding:
Expand Down Expand Up @@ -47,11 +48,6 @@ outputs:
runs:
using: "composite"
steps:
- name: Setup PHP and disable opcache
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
extensions: none, curl, json, mbstring, pcre, phar
- name: Get PlatformSH URL
shell: bash
id: platformsh_url
Expand All @@ -65,7 +61,7 @@ runs:
export PLATFORM_BRANCH=${{ inputs.ENVIRONMENT_NAME }};
export PLATFORMSH_CLI_TOKEN=${{ inputs.PLATFORMSH_KEY }};
curl -fsS https://platform.sh/cli/installer | php
curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash
if [[ "${{ inputs.ALLOW_CANCEL_CRON }}" == 1 ]]; then \
~/.platformsh/bin/platform activity:cancel --type=environment.cron; \
Expand Down

0 comments on commit 6e49578

Please sign in to comment.