chore: fixing issue template (#210) #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: test and autofix.ci | ||
| on: | ||
| pull_request: | ||
| branches: ['main'] | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| autofix: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: '.node_version' | ||
| - run: npm ci | ||
| - run: npx prettier --write . | ||
| env: | ||
| GITHUB_COMMIT_MESSAGE: '${{ github.event.head_commit.message }}' | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| # setup node.js | ||
| - name: Setup node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: '.node_version' | ||
| # install node packages | ||
| - name: Install node dependencies | ||
| run: npm install | ||
| # accesses some git variables and processes them to be lower case/short/escaped | ||
| - name: Inject slug/short variables | ||
| uses: rlespinasse/github-slug-action@v3.x | ||
| # Configure git-specific .env file | ||
| - name: Expose git-specific information to the Vite environment | ||
| env: | ||
| ENV_FILE: 'env/.env.git.local' | ||
| run: | | ||
| escape_quotes() { | ||
| # Get the input string | ||
| input="$1" | ||
| # Escape single quotes | ||
| input="${input//\'/\'}" | ||
| # Escape double quotes | ||
| input="${input//\"/\\\"}" | ||
| # Return the escaped string | ||
| echo "$input" | ||
| } | ||
| echo "------" | ||
| echo "# DO NOT EDIT THIS FILE IT IS AUTOMATICALLY GENERATED" > $ENV_FILE | ||
| if test -z "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" | ||
| then | ||
| echo "VITE_PROJECT_NAME = unknown" >> $ENV_FILE | ||
| VITE_PROJECT_NAME='unknown' | ||
| else | ||
| echo "VITE_PROJECT_NAME = ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" >> $ENV_FILE | ||
| VITE_PROJECT_NAME='${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}' | ||
| fi | ||
| if test -z "${{ env.GITHUB_SHA_SHORT }}" | ||
| then | ||
| echo "VITE_GIT_HASH = x0x0x0x0" >> $ENV_FILE | ||
| VITE_GIT_HASH='x0x0x0x0' | ||
| else | ||
| echo "VITE_GIT_HASH = ${{ env.GITHUB_SHA_SHORT }}" >> $ENV_FILE | ||
| VITE_GIT_HASH='${{ env.GITHUB_SHA_SHORT }}' | ||
| fi | ||
| if test -z "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" | ||
| then | ||
| echo "VITE_GIT_OWNER = unknown_owner" >> $ENV_FILE | ||
| VITE_GIT_OWNER='unknown_owner' | ||
| else | ||
| echo "VITE_GIT_OWNER = ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" >> $ENV_FILE | ||
| VITE_GIT_OWNER='${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}' | ||
| fi | ||
| if test -z "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" | ||
| then | ||
| echo "VITE_GIT_REPO_NAME = unknown_repo" >> $ENV_FILE | ||
| VITE_GIT_REPO_NAME='unknown_repo' | ||
| else | ||
| echo "VITE_GIT_REPO_NAME = ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" >> $ENV_FILE | ||
| VITE_GIT_REPO_NAME='${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}' | ||
| fi | ||
| if test -z "${{ env.GITHUB_REF_SLUG }}" | ||
| then | ||
| echo "VITE_GIT_BRANCH_NAME = unknown_branch" >> $ENV_FILE | ||
| VITE_GIT_BRANCH_NAME='unknown_branch' | ||
| else | ||
| echo "VITE_GIT_BRANCH_NAME = ${{ env.GITHUB_REF_SLUG }}" >> $ENV_FILE | ||
| VITE_GIT_BRANCH_NAME='${{ env.GITHUB_REF_SLUG }}' | ||
| fi | ||
| if test -z "${{ github.event.head_commit.message }}" | ||
| then | ||
| echo "VITE_GIT_LAST_MSG = (no commit message)" >> $ENV_FILE | ||
| VITE_GIT_LAST_MSG='(no commit message)' | ||
| else | ||
| echo "VITE_GIT_LAST_MSG = $GITHUB_COMMIT_MESSAGE" >> $ENV_FILE | ||
| VITE_GIT_LAST_MSG="$GITHUB_COMMIT_MESSAGE" | ||
| fi | ||
| echo "VITE_DEPLOY_BASE_PATH = '/${VITE_GIT_OWNER}/${VITE_GIT_REPO_NAME}/${VITE_GIT_BRANCH_NAME}/'" >> $ENV_FILE | ||
| CODENAME=$(node scripts/codenamize.cjs "/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}/${{ env.GITHUB_REF_SLUG }}") | ||
| echo "VITE_CODE_NAME = ${CODENAME}" >> $ENV_FILE | ||
| cat $ENV_FILE | ||
| # place the deploy settings into the environment files | ||
| # this one needs to be made available to vite.config.js | ||
| - name: create mock deploy file | ||
| env: | ||
| DEPLOY_ENV_FILE: 'env/.env.local' | ||
| run: | | ||
| echo "VITE_FIREBASE_APIKEY=mock-api-key" > $DEPLOY_ENV_FILE | ||
| echo "VITE_FIREBASE_AUTHDOMAIN=mock-auth-domain" >> $DEPLOY_ENV_FILE | ||
| echo "VITE_FIREBASE_PROJECTID=mock-project-id" >> $DEPLOY_ENV_FILE | ||
| echo "VITE_FIREBASE_STORAGEBUCKET=mock-storage-bucket" >> $DEPLOY_ENV_FILE | ||
| echo "VITE_FIREBASE_MESSAGINGSENDERID=mock-messaging-sender-id" >> $DEPLOY_ENV_FILE | ||
| echo "VITE_FIREBASE_APPID=mock-app-id" >> $DEPLOY_ENV_FILE | ||
| cat $DEPLOY_ENV_FILE | ||
| # place the deploy settings into the environment files | ||
| # this one needs to be made available to vite.config.js | ||
| - name: create mock deploy.local file | ||
| env: | ||
| DEPLOY_ENV_FILE: 'env/.env.deploy.local' | ||
| run: | | ||
| echo "VITE_DEPLOY_BASE_PATH = '/mock-owner/mock-repo/mock-branch/'" > $DEPLOY_ENV_FILE | ||
| echo "VITE_DEPLOY_URL = 'https://mock-deploy-host/mock-owner/mock-repo/mock-branch/'" >> $DEPLOY_ENV_FILE | ||
| echo 'VITE_CODE_NAME_DEPLOY_URL = "https://mock-deploy-host/e/mock-code-name"' >> $DEPLOY_ENV_FILE | ||
| cat $DEPLOY_ENV_FILE | ||
| # load the environment | ||
| - name: Load the github dotenv file | ||
| id: dotenv_github | ||
| uses: falti/dotenv-action@v1.1 | ||
| with: | ||
| path: 'env/.env.git.local' | ||
| - name: Load the general config dotenv file | ||
| id: dotenv_config | ||
| uses: falti/dotenv-action@v1.1 | ||
| with: | ||
| path: './env/.env.local' | ||
| - name: Load the deploy general config dotenv file | ||
| id: dotenv_deploy | ||
| uses: falti/dotenv-action@v1.1 | ||
| with: | ||
| path: './env/.env.deploy.local' | ||
| # run tests | ||
| - name: Run tests | ||
| id: run-tests | ||
| run: npm run test | ||
| - uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 | ||