Skip to content

Commit

Permalink
feat(*): Add disable_checkout_action input (#12)
Browse files Browse the repository at this point in the history
* feat(disable checkout): Add a boolean input for disabling checkout action

* docs(readme): Add disable_checkout_action input description
  • Loading branch information
julienloizelet authored Aug 21, 2023
1 parent 5036b19 commit 371c4bd
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/add-on-disable-checkout-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Add-on with disabled checkout tests
on:
push:
branches:
- main
paths-ignore:
- '**.md'
schedule:
- cron: '35 08 * * *'
workflow_dispatch:

permissions:
contents: write


jobs:
add-on-disable-checkout-test:
strategy:
fail-fast: false
matrix:
ddev_version: [ stable ]
add_on: ["JanoPL/ddev-kibana"]

name: Add-on with disabled checkout tests
runs-on: ubuntu-latest

steps:

- name: Clone current repository
uses: actions/checkout@v3

- name: Retrieve last tag of add-on
run: |
echo "ADD_ON_LAST_TAG=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/${{ matrix.add_on }}/releases/latest | grep -oP "\/tag\/\K(.*)$")" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ matrix.add_on }}
ref: ${{ env.ADD_ON_LAST_TAG }}
path: tested-addon
submodules: 'true'

- name: Run DDEV test (${{ matrix.ddev_version }})
uses: ./
with:
ddev_version: ${{ matrix.ddev_version }}
token: ${{ secrets.GITHUB_TOKEN }}
addon_repository: ${{ matrix.add_on }}
addon_ref: ${{ env.ADD_ON_LAST_TAG }}
addon_path: tested-addon
keepalive: false
disable_checkout_action: true

2 changes: 1 addition & 1 deletion .github/workflows/add-on-multiple-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ddev_version: [ stable, HEAD ]
ddev_version: [ stable ]
add_on: ["ddev/ddev-redis-commander", "ddev/ddev-mongo", "ddev/ddev-adminer"]

name: Add-on multiple tests
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ Default: `false`.

---

- `disable_checkout_action` (_Boolean_)

If you need to check out your add-on source code with some specific inputs (`submodules`, `ssh-key`, etc.), or you need to perform some extra steps between checkout and DDEV installation steps, you can disable the default checkout action by setting `true` for this input.

Not required.

Default: `false`.

---

## Usage

### Test your DDEV add-on
Expand Down
7 changes: 7 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ inputs:
required: false
default: false

disable_checkout_action:
type: boolean
description: Disable addon checkout action
required: false
default: false

token:
description: 'A Github PAT'
required: true
Expand All @@ -60,6 +66,7 @@ runs:
mkcert -install
- uses: actions/checkout@v3
if: inputs.disable_checkout_action == 'false'
with:
repository: ${{ inputs.addon_repository }}
ref: ${{ inputs.addon_ref }}
Expand Down

0 comments on commit 371c4bd

Please sign in to comment.