diff --git a/.github/workflows/ga-compliance.yml b/.github/workflows/ga-compliance.yml new file mode 100644 index 0000000..3397ef9 --- /dev/null +++ b/.github/workflows/ga-compliance.yml @@ -0,0 +1,48 @@ +# Workflow for DevTools Compliance + +name: DevTools Compliance + +on: + pull_request: + types: + [ + opened, + edited, + synchronize, + reopened, + labeled, + unlabeled, + assigned, + unassigned, + ] + +jobs: + check-compliance: + name: Check DevTools Compliance + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Show PR Labels and Assignees + run: | + echo "PR Labels: ${{ toJson(github.event.pull_request.labels) }}" + echo "PR Assignees: ${{ toJson(github.event.pull_request.assignees) }}" + + - name: Verify PR Assignee + run: | + if [ "${{ toJson(github.event.pull_request.assignees) }}" == "[]" ]; then + echo "👮 This PR does not have any assignees. Please assign at least one assignee." + exit 1 + fi + + - name: Verify PR Label + run: | + if [ "${{ toJson(github.event.pull_request.labels) }}" == "[]" ]; then + echo "👮 This PR does not have any labels. Please assign at least one label." + exit 1 + fi + continue-on-error: true diff --git a/.github/workflows/ga-linter-fmt.yml b/.github/workflows/ga-linter-fmt.yml new file mode 100644 index 0000000..ed355eb --- /dev/null +++ b/.github/workflows/ga-linter-fmt.yml @@ -0,0 +1,56 @@ +# Workflow for DevTools CI/CD +# This workflow runs linting and formatting checks on pull requests. +# It ensures that the code adheres to style guidelines and is free of linting errors. + +name: DevTools CI/CD + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + lint-and-format: + name: Lint and Format Check + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Deno + uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + + - name: Cache Deno dependencies + uses: actions/cache@v4 + with: + path: | + ~/.deno + ~/node_modules + ~/.cache/deno + + key: ${{ runner.os }}-deno-v2-${{ hashFiles('deno.json') }} + + - name: 🔍 Get all changed files + id: changed-file-list + run: | + echo "changed_files=$(git diff --name-only --diff-filter=ACMRT --merge-base origin/master | xargs)" >> $GITHUB_OUTPUT + + - name: Run linter + if: steps.changed-file-list.outputs.changed_files != '' + run: deno task lint --permit-no-files --compact ${{ steps.changed-file-list.outputs.changed_files }} + + - name: Run formatter + if: steps.changed-file-list.outputs.changed_files != '' + run: deno task fmt --permit-no-files --check ${{ steps.changed-file-list.outputs.changed_files }} + + - name: Run check + if: steps.changed-file-list.outputs.changed_files != '' + run: deno check --allow-import + + - name: Run tests + if: steps.changed-file-list.outputs.changed_files != '' + run: deno test -A --no-check --env-file=.env-dev