diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..9334b62 --- /dev/null +++ b/.github/dependabot.yml @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..834668b --- /dev/null +++ b/.github/workflows/lint.yml @@ -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/action-yamllint@v1.5.0 + with: + strict: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 623913c..0bc873f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,3 +1,4 @@ +--- name: "Testing action-platformsh-url" on: pull_request @@ -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 @@ -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 @@ -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.') @@ -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 @@ -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.') diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..7e0c742 --- /dev/null +++ b/.yamllint @@ -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 diff --git a/README.md b/README.md index 2ee986f..0bedfec 100644 --- a/README.md +++ b/README.md @@ -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. + diff --git a/action.yml b/action.yml index cab3564..0786ff4 100644 --- a/action.yml +++ b/action.yml @@ -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: @@ -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 @@ -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; \