Skip to content

ci: merge actions

ci: merge actions #754

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [created]
permissions:
contents: write
pull-requests: write
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
- run: npm install
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
sonarcloud:
needs: ["test"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install Node.js
uses: actions/setup-node@v3
- run: npm install
- run: xvfb-run -a npm test
- uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
publish:
if: success() && startsWith( github.ref, 'refs/tags/v')
needs: ["test", "sonarcloud"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
- run: npm install
- run: npm run compile
- run: npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
needs: ["test", "sonarcloud"]
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}