From dc3c56dd9e0831463a0d0ef7fe7b4f966f340782 Mon Sep 17 00:00:00 2001 From: ClaudiaFang Date: Sat, 25 Apr 2026 04:19:52 +0000 Subject: [PATCH] chore: use direct Lint and Test jobs to satisfy branch protection rules --- .github/workflows/check.yml | 47 +++++++++++++++++--------- .github/workflows/reusable-check.yml | 46 ------------------------- .github/workflows/semantic-release.yml | 45 ++++++++++++++---------- 3 files changed, 59 insertions(+), 79 deletions(-) delete mode 100644 .github/workflows/reusable-check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 90696c1..28fa1ed 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,29 +11,46 @@ on: - master jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + - run: npm ci + - run: npm run lint + test: - uses: ./.github/workflows/reusable-check.yml + name: Test + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + - run: npm ci + - run: npm run test -- --coverage + - id: version + run: echo "version=$(node -p "require('./manifest.json').version")" >> $GITHUB_OUTPUT artifact: name: Package Artifact runs-on: ubuntu-latest needs: test steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: '22' cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Build plugin - run: npm run build - + - run: npm ci + - run: npm run build - name: Create plugin package run: | VERSION=${{ needs.test.outputs.version }} @@ -42,9 +59,7 @@ jobs: ZIP_NAME="git-files-sync-${VERSION}-${BRANCH_NAME_SAFE}.zip" zip -j "$ZIP_NAME" main.js manifest.json styles.css echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v4 with: name: plugin-build-${{ needs.test.outputs.version }}-${{ github.sha }} path: ${{ env.ZIP_NAME }} diff --git a/.github/workflows/reusable-check.yml b/.github/workflows/reusable-check.yml deleted file mode 100644 index 2cc07ea..0000000 --- a/.github/workflows/reusable-check.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Reusable Check - -on: - workflow_call: - outputs: - version: - description: "The version from manifest.json" - value: ${{ jobs.check.outputs.version }} - -jobs: - check: - name: Lint, Test, and Build - runs-on: ubuntu-latest - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '22' - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Run linter - run: npm run lint - - - name: Run tests with coverage - run: npm run test -- --coverage - - - name: Build plugin - run: npm run build - - - name: Check build artifacts - run: | - if [ ! -f main.js ]; then exit 1; fi - if [ ! -f manifest.json ]; then exit 1; fi - if [ ! -f styles.css ]; then exit 1; fi - - - name: Get version from manifest - id: version - run: echo "version=$(node -p "require('./manifest.json').version")" >> $GITHUB_OUTPUT diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml index 7786228..527873d 100644 --- a/.github/workflows/semantic-release.yml +++ b/.github/workflows/semantic-release.yml @@ -12,34 +12,45 @@ permissions: pull-requests: write jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + - run: npm ci + - run: npm run lint + test: - uses: ./.github/workflows/reusable-check.yml + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + - run: npm ci + - run: npm run test -- --coverage release: name: Build and Release runs-on: ubuntu-latest - needs: test - + needs: [lint, test] steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: fetch-depth: 0 persist-credentials: false - - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: '22' cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Build plugin - run: npm run build - - - name: Release - env: + - run: npm ci + - run: npm run build + - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npx semantic-release