From c7ac184f3dc67335f9086cb6fd7b64a73c461bab Mon Sep 17 00:00:00 2001 From: Deepanshu Sukhija Date: Tue, 26 Mar 2024 12:59:40 +0530 Subject: [PATCH 1/2] Added warning messages --- action.yml | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/action.yml b/action.yml index 41593af..1fbac9a 100644 --- a/action.yml +++ b/action.yml @@ -10,11 +10,11 @@ inputs: paragonZeusUrl: type: string required: false - default: https://zeus.useparagon.com + default: "https://zeus.useparagon.com" paragonDashboardUrl: type: string required: false - default: https://dashboard.useparagon.com + default: "https://dashboard.useparagon.com" runs: using: 'composite' @@ -45,29 +45,27 @@ runs: id: validate shell: bash run: | - if [ "${{ steps.validateGitSync.outputs.projectId }}" = "null" ]; then - echo "projectId is not provided." - exit 1 - fi - - if [ "${{ steps.validateGitSync.outputs.commitId }}" = "null" ]; then - echo "commitId is not provided." - exit 1 - fi - - if [ -z "${{ inputs.paragonKey }}" ]; then - echo "paragonKey is not provided." - exit 1 - fi + if [ "${{ steps.validateGitSync.outputs.projectId }}" = "null" ] || [ "${{ steps.validateGitSync.outputs.commitId }}" = "null" ]; then + echo "::warning::Branch \"${{ github.ref_name }}\" is not linked to any projects in Paragon. + See docs on setting up Git Sync for a branch: https://docs.useparagon.com/paragraph/setting-up-git-sync + + Proceeding with a build-only run (no contents will be pushed to Paragon)..." + echo "valid=false" >> $GITHUB_OUTPUT + + elif [ -z "${{ inputs.paragonKey }}" ]; then + echo "::warning:: \"paragonKey\" is not provided." + echo "valid=false" >> $GITHUB_OUTPUT + + elif [ -z "${{ inputs.paragonZeusUrl }}" ]; then + echo "::warning:: \"paragonZeusUrl\" is not provided." + echo "valid=false" >> $GITHUB_OUTPUT - if [ -z "${{ inputs.paragonZeusUrl }}" ]; then - echo "paragonZeusUrl is not provided." - exit 1 - fi + elif [ -z "${{ inputs.paragonDashboardUrl }}" ]; then + echo "::warning:: \"paragonDashboardUrl\" is not provided." + echo "valid=false" >> $GITHUB_OUTPUT - if [ -z "${{ inputs.paragonDashboardUrl }}" ]; then - echo "paragonDashboardUrl is not provided." - exit 1 + else + echo "valid=true" >> $GITHUB_OUTPUT fi - name: Setup Node.js environment @@ -117,7 +115,7 @@ runs: - name: Push to Paragon shell: bash - if: github.event_name == 'push' + if: github.event_name == 'push' && steps.validate.outputs.valid == 'true' run: para push # Post steps @@ -128,7 +126,7 @@ runs: PARAGON_HOST_ZEUS: ${{ inputs.paragonZeusUrl }} PROJECT_ID: ${{ steps.validateGitSync.outputs.projectId }} COMMIT_ID: ${{ steps.validateGitSync.outputs.commitId }} - if: ${{ success() }} + if: success() && steps.validate.outputs.valid == 'true' run: | echo "Commit succeeded!" curl -X PATCH \ @@ -144,7 +142,7 @@ runs: PARAGON_HOST_ZEUS: ${{ inputs.paragonZeusUrl }} PROJECT_ID: ${{ steps.validateGitSync.outputs.projectId }} COMMIT_ID: ${{ steps.validateGitSync.outputs.commitId }} - if: ${{ failure() }} + if: failure() && steps.validate.outputs.valid == 'true' run: | echo "Commit failed!" curl -X PATCH \ From 1d3ce245e4c6e18193aab9892be55db2c04a3865 Mon Sep 17 00:00:00 2001 From: Deepanshu Sukhija Date: Tue, 26 Mar 2024 13:18:32 +0530 Subject: [PATCH 2/2] Updated required & optional inputs --- README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 12e55a0..c7e334a 100644 --- a/README.md +++ b/README.md @@ -31,14 +31,11 @@ jobs: Make sure to replace ${{ secrets.PARAGON_CLI_KEY }}, ${{ secrets.ZEUS_URL }}, and ${{ secrets.DASHBOARD_URL }} with your actual secrets. Also, ensure to use the correct version of the action. ## Inputs -- paragonKey -Required. Paragon CLI key for authentication. +- `paragonKey` (Required)\ +Paragon CLI key for authentication. -- npmToken -Required. NPM token for package publishing. +- `paragonZeusUrl` (Optional)\ +URL for Paragon Zeus. -- paragonZeusUrl -Required. URL for Paragon Zeus. - -- paragonDashboardUrl -Required. URL for Paragon Dashboard. +- `paragonDashboardUrl` (Optional)\ +URL for Paragon Dashboard.