refactor(ci): restrict workflow permissions to least privilege #205
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: Build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| with: | |
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Select Node Version | |
| uses: svierk/get-node-version@main | |
| with: | |
| package-manager: 'yarn' | |
| - name: Install Dependencies | |
| uses: borales/actions-yarn@v4 | |
| with: | |
| cmd: install # will run `yarn install` command | |
| - name: Check Prettier | |
| run: yarn run prettier | |
| - name: Check ESLint | |
| run: yarn run lint | |
| - name: LWC Unit Tests | |
| run: yarn run test:unit | |
| - name: Build Production Bundle | |
| uses: borales/actions-yarn@v4 | |
| with: | |
| cmd: build # will run `yarn build` command |