Skip to content

Commit

Permalink
Merge pull request #2 from useparagon/dev
Browse files Browse the repository at this point in the history
Updated warning messages and step conditions
  • Loading branch information
loren-paragon authored Apr 2, 2024
2 parents a837be7 + 1d3ce24 commit 0e87aa7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 35 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
50 changes: 24 additions & 26 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 \
Expand All @@ -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 \
Expand Down

0 comments on commit 0e87aa7

Please sign in to comment.