|
| 1 | +name: Quality |
| 2 | +permissions: |
| 3 | + contents: read |
| 4 | + pull-requests: write |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + types: [opened, synchronize, reopened] |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + knip: |
| 16 | + runs-on: ubuntu-22.04 |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 |
| 20 | + - uses: actions/setup-node@v4 |
| 21 | + with: |
| 22 | + node-version-file: "package.json" |
| 23 | + cache: "pnpm" |
| 24 | + |
| 25 | + - name: Install deps |
| 26 | + run: pnpm install |
| 27 | + |
| 28 | + - name: Knip for unused files, dependencies and exports |
| 29 | + run: pnpm run knip |
| 30 | + |
| 31 | + graphql-lint-unused: |
| 32 | + runs-on: ubuntu-22.04 |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 |
| 36 | + - uses: actions/setup-node@v4 |
| 37 | + with: |
| 38 | + node-version-file: "package.json" |
| 39 | + cache: "pnpm" |
| 40 | + |
| 41 | + - name: Install deps |
| 42 | + run: pnpm install |
| 43 | + |
| 44 | + - name: Run graphql-lint-unused |
| 45 | + id: graphql-lint |
| 46 | + continue-on-error: true |
| 47 | + run: | |
| 48 | + OUTPUT=$(pnpm run graphql-lint-unused 2>&1) || true |
| 49 | + echo "$OUTPUT" |
| 50 | + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) |
| 51 | + echo "result<<$EOF" >> "$GITHUB_OUTPUT" |
| 52 | + echo "$OUTPUT" >> "$GITHUB_OUTPUT" |
| 53 | + echo "$EOF" >> "$GITHUB_OUTPUT" |
| 54 | +
|
| 55 | + - name: Comment PR with results |
| 56 | + uses: peter-evans/create-or-update-comment@v4 |
| 57 | + with: |
| 58 | + issue-number: ${{ github.event.pull_request.number }} |
| 59 | + body: | |
| 60 | + ## GraphQL Unused Fields Report |
| 61 | +
|
| 62 | + ``` |
| 63 | + ${{ steps.graphql-lint.outputs.result }} |
| 64 | + ``` |
| 65 | + comment-tag: graphql-lint-unused |
0 commit comments