chore(workflows): run test on pull_request #10
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: test | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: 1.24 | |
| - name: Setup CodeQL | |
| id: codeqlsetup | |
| uses: github/codeql-action/setup-codeql@v4 | |
| - name: Add CodeQL to PATH # see https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#adding-a-system-path | |
| run: | | |
| # 1. get the full path of CodeQL | |
| FULL_PATH="${{ steps.codeqlsetup.outputs.codeql-path }}" | |
| # 2. use dirname to get the directory of CodeQL binary | |
| CODEQL_DIR=$(dirname "$FULL_PATH") | |
| # 3. add CodeQL directory to GITHUB_PATH | |
| echo "$CODEQL_DIR" >> $GITHUB_PATH | |
| # print the CodeQL directory to confirm | |
| echo "Adding $CODEQL_DIR to PATH" | |
| - name: Test | |
| run: | | |
| ./check.sh | |
| - name: Setup tmate session # see https://github.com/mxschmitt/action-tmate#only-on-failure | |
| uses: mxschmitt/action-tmate@v3 | |
| if: ${{ failure() }} | |