ci: include workflow write permission for changelog steps #3132
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: Node.js | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| test: | |
| timeout-minutes: 4 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| node-version: [18.x, 20.x, 22.x] | |
| package: | |
| - cli-hooks | |
| - cli-test | |
| - logger | |
| - oauth | |
| - rtm-api | |
| - socket-mode | |
| - types | |
| - web-api | |
| - webhook | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Configure git settings (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| git config --global core.autocrlf false | |
| git config --global core.eol lf | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - run: npm --version | |
| - name: Install dependencies | |
| run: | | |
| npm install --verbose | |
| - name: Build packages | |
| run: | | |
| # Build packages without internal dependencies | |
| npm run build --workspace=@slack/cli-hooks | |
| npm run build --workspace=@slack/cli-test | |
| # Build base dependencies | |
| npm run build --workspace=@slack/logger | |
| npm run build --workspace=@slack/types | |
| # Build packages requiring base dependencies | |
| npm run build --workspace=@slack/web-api | |
| npm run build --workspace=@slack/webhook | |
| # Build packages that depend on the Web API | |
| npm run build --workspace=@slack/oauth | |
| npm run build --workspace=@slack/rtm-api | |
| npm run build --workspace=@slack/socket-mode | |
| - name: Run tests | |
| run: | | |
| npm run lint | |
| npm test --workspace=@slack/${{ matrix.package }} | |
| - name: Check for coverage report existence | |
| id: check_coverage | |
| uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 | |
| with: | |
| files: packages/${{ matrix.package }}/coverage/lcov.info | |
| - name: Upload code coverage | |
| if: matrix.node-version == '22.x' && matrix.os == 'ubuntu-latest' && steps.check_coverage.outputs.files_exists == 'true' | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| with: | |
| directory: packages/${{ matrix.package }}/coverage | |
| fail_ci_if_error: true | |
| flags: ${{ matrix.package }} | |
| report_type: coverage | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| with: | |
| fail_ci_if_error: true | |
| files: packages/${{ matrix.package }}/coverage/test-results.xml | |
| flags: ${{ matrix.node-version }},${{ matrix.os }},${{ matrix.package }} | |
| report_type: test_results | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true |