fix: minimatch high vulnerability for direct dependencies #35
Workflow file for this run
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: Collection Scripts Library CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| paths: | |
| - "lib/**" | |
| pull_request: | |
| branches: [main, develop] | |
| paths: | |
| - "lib/**" | |
| workflow_dispatch: | |
| env: | |
| NODE_VERSION: "20" | |
| jobs: | |
| lint-and-test: | |
| name: Lint and Test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: lib | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "npm" | |
| cache-dependency-path: "lib/package-lock.json" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build TypeScript | |
| run: npm run build | |
| - name: Run tests | |
| run: npm test | |
| publish: | |
| name: Publish to npmjs | |
| runs-on: ubuntu-latest | |
| needs: lint-and-test | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: write | |
| defaults: | |
| run: | |
| working-directory: lib | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "npm" | |
| cache-dependency-path: "lib/package-lock.json" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build TypeScript | |
| run: npm run build | |
| - name: Check if version changed | |
| id: version-check | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT | |
| # Check if this version tag already exists | |
| if git tag -l "collection-scripts-v$PACKAGE_VERSION" | grep -q .; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Publish package | |
| if: steps.version-check.outputs.exists == 'false' | |
| run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create version tag | |
| if: steps.version-check.outputs.exists == 'false' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag "collection-scripts-v${{ steps.version-check.outputs.version }}" | |
| git push origin "collection-scripts-v${{ steps.version-check.outputs.version }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Skip publish (version exists) | |
| if: steps.version-check.outputs.exists == 'true' | |
| run: | | |
| echo "Version ${{ steps.version-check.outputs.version }} already published, skipping." |