From 5f8736cc9f5e587a8aa615fe9dfb90f490e999b6 Mon Sep 17 00:00:00 2001 From: Robert Vintila <33718597+gasher@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:16:26 +0200 Subject: [PATCH] Add format check command and github action. (#9) * Add format check command and github action. * Fix github action. --- .github/workflows/format-check.yaml | 32 +++++++++++++++++++++++++++++ package.json | 3 ++- pages/onboarding.js | 5 ++++- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/format-check.yaml diff --git a/.github/workflows/format-check.yaml b/.github/workflows/format-check.yaml new file mode 100644 index 0000000..cb28911 --- /dev/null +++ b/.github/workflows/format-check.yaml @@ -0,0 +1,32 @@ +name: format-check + +# Controls when the workflow will run +on: + pull_request: + branches: + - master + - main + +# Auto cancels previous running CI jobs in this PR on each new commit +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + format-check: + runs-on: ubuntu-latest-m + env: + NODE_VERSION: 19.x + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install dependencies + run: npm ci + + - name: Format check + run: npm run format-check diff --git a/package.json b/package.json index cc3f4c0..04416c1 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "build": "next build", "start": "next start", "lint": "next lint", - "format": "dprint fmt && next lint --fix" + "format": "dprint fmt && next lint --fix", + "format-check": "dprint check && next lint" }, "dependencies": { "autoprefixer": "^10.4.7", diff --git a/pages/onboarding.js b/pages/onboarding.js index 28198e4..b7fba27 100644 --- a/pages/onboarding.js +++ b/pages/onboarding.js @@ -100,7 +100,10 @@ const OnboardingSuccess = ({ handleSubmit }) => ( export default function Onboarding() { const [isSubmitted, setIsSubmitted] = useState(false); const [holderDID] = useLocalStorage('holderDID', process.env.NEXT_PUBLIC_HOLDER_DID); - const [recipientEmail] = useLocalStorage('recipientEmail', process.env.NEXT_PUBLIC_RECIPIENT_EMAIL); + const [recipientEmail] = useLocalStorage( + 'recipientEmail', + process.env.NEXT_PUBLIC_RECIPIENT_EMAIL + ); const router = useRouter(); const handleFormSubmit = async (event) => {