name: Lint on: [pull_request] jobs: lintrunner: runs-on: ubuntu-latest steps: - name: Pull DGL uses: actions/checkout@v3 with: fetch-depth: 0 - name: Checkout master and HEAD run: | git checkout -t origin/master git checkout ${{ github.event.pull_request.head.sha }} - name: Setup Python uses: actions/setup-python@v4 with: python-version: '3.8' - name: Install requirements run: | python -m pip install --upgrade pip pip install lintrunner --user - name: Initialize lint dependencies run: lintrunner init - name: Run lintrunner on all changed files run: | set +e if ! lintrunner --force-color -m master --tee-json=lint.json; then echo "" echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner\`.\e[0m" echo -e "\e[1m\e[36mSee https://github.com/pytorch/pytorch/wiki/lintrunner for setup instructions.\e[0m" exit 1 fi - name: Store annotations if: always() && github.event_name == 'pull_request' # Don't show this as an error; the above step will have already failed. continue-on-error: true run: | # Use jq to massage the JSON lint output into GitHub Actions workflow commands. jq --raw-output \ '"::\(if .severity == "advice" or .severity == "disabled" then "warning" else .severity end) file=\(.path),line=\(.line),col=\(.char),title=\(.code) \(.name)::" + (.description | gsub("\\n"; "%0A"))' \ lint.json concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} cancel-in-progress: true