From f21d6805048f4215b8be459e7b8c427ee2f4905a Mon Sep 17 00:00:00 2001 From: Robbie McKinstry Date: Tue, 22 Jul 2025 12:56:45 -0400 Subject: [PATCH 1/2] Debugging missing SHA --- .github/workflows/on-push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index 59d7b4e..fcb31b0 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -13,6 +13,6 @@ jobs: uses: actions/checkout@v4 - name: Test MultiTool Action - uses: wack/multitool-action@${{ github.sha }} + uses: "wack/multitool-action@${{ env.GITHUB_SHA }}" with: - input-string: "test input" \ No newline at end of file + input-string: "test input" From daf1adabaabac21d86992e3ee0d074f3e2863396 Mon Sep 17 00:00:00 2001 From: Robbie McKinstry Date: Tue, 22 Jul 2025 12:58:05 -0400 Subject: [PATCH 2/2] Test login. --- .github/workflows/on-push.yml | 34 +++++++++++++++++++--- action.yml | 53 ++++++++++++++++++++++++++++++----- 2 files changed, 76 insertions(+), 11 deletions(-) diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index fcb31b0..55bbbae 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -11,8 +11,34 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - - name: Test MultiTool Action - uses: "wack/multitool-action@${{ env.GITHUB_SHA }}" + + # Test whether the Action installs correctly. + - name: Install MultiTool via Action + uses: "./" + with: + install-only: true + version: "v0.3.0" + + - name: "Test CLI is installed" + run: "which multi" + + - name: "Test CLI help works" + run: "multi -h" + + - name: "Test CLI version matches" + run: | + if [ $(multi version) = "v0.3.0" ]; then + echo "Version is correct." + else + echo "Version is incorrect." + exit 1 + fi + + # Test whether the Action logs in correctly. + - name: Login + uses: "./" with: - input-string: "test input" + email: ${{ secrets.MULTITOOL_QA_EMAIL }} + password: ${{ secrets.MULTITOOL_QA_PASSWORD }} + dry-run: true + cache-binary: false diff --git a/action.yml b/action.yml index 9f03f6e..afbb5cb 100644 --- a/action.yml +++ b/action.yml @@ -1,10 +1,37 @@ name: 'MultiTool' +# TODO: Add an action description. +# TODO: Run Taplo YAML checker over this file. +# TODO: Change single quotes to double quotes description: '' inputs: - input-string: - description: 'Input string' - required: true + version: + description: 'Version string (e.g. v0.3.0). If none provided, defaults to latest' + required: false + default: "latest" + + install-only: + description: "Whether to install the CLI and then exit" + required: false + default: false + + dry-run: + description: "Skips running `multi run`. Useful for testing login credentials." + required: false + default: false + + email: + description: "An email address to use when logging in." + required: false + + password: + description: "The password to use when logging in. NB: Pass this as an environment secret." + required: false + + cache-binary: + description: "When enabled (default), the `multi` binary will be added to the Actions cache and reused between runs" + required: false + default: true outputs: output-string: @@ -14,8 +41,20 @@ outputs: runs: using: 'composite' steps: - - name: 'MultiTool Step' - id: multitool-step + - name: Install the MultiTool CLI + uses: jaxxstorm/action-install-gh-release@v2.1.0 + with: # Grab the latest version + repo: wack/multitool + tag: ${{ inputs.version }} + cache: ${{ inputs.cache-binary && 'enable' }} + + - name: Login + shell: bash + if: ${{ !inputs.install-only }} + run: "multi login --enable-colors=always --email=${{ inputs.email }} --password=${{ inputs.password }}" + + - name: Multi Run shell: bash - run: | - echo "result=${{ inputs.input-string }}" >> $GITHUB_OUTPUT \ No newline at end of file + if: ${{ !(inputs.install-only || inputs.dry-run) }} + run: "multi run --enable-colors=always" +