|
| 1 | +name: Resyntax Analysis |
| 2 | + |
| 3 | +# The Resyntax integration is split into two phases: a workflow that analyzes the code and uploads |
| 4 | +# the analysis as an artifact, and a workflow that downloads the analysis artifact and creates a |
| 5 | +# review of the pull request. This split is for permissions reasons; the analysis workflow checks out |
| 6 | +# the pull request branch and compiles it, executing arbitrary code as it does so. For that reason, |
| 7 | +# the first workflow has read-only permissions in the github repository. The second workflow only |
| 8 | +# downloads the pull request review artifact and submits it, and it executes with read-write permissions |
| 9 | +# without executing any code in the repository. This division of responsibilities allows Resyntax to |
| 10 | +# safely analyze pull requests from forks. This strategy is outlined in the following article: |
| 11 | +# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ |
| 12 | + |
| 13 | +on: |
| 14 | + pull_request: |
| 15 | + types: |
| 16 | + - opened |
| 17 | + - edited |
| 18 | + - reopened |
| 19 | + - synchronize |
| 20 | + - ready_for_review |
| 21 | + |
| 22 | +jobs: |
| 23 | + analyze: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + env: |
| 26 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + |
| 28 | + steps: |
| 29 | + |
| 30 | + # See https://github.com/actions/checkout/issues/118. |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + |
| 34 | + with: |
| 35 | + version: current |
| 36 | + packages: resyntax |
| 37 | + local_catalogs: $GITHUB_WORKSPACE |
| 38 | + dest: '"${HOME}/racketdist-current-CS"' |
| 39 | + sudo: never |
| 40 | + - name: Register local packages |
| 41 | + run: | |
| 42 | + raco pkg install -i --auto --no-setup --skip-installed typed-racket-test |
| 43 | + raco pkg update --auto --no-setup source-syntax typed-racket-lib typed-racket-more typed-racket-compatibility typed-racket-doc typed-racket typed-racket-test |
| 44 | + - name: Install local packages |
| 45 | + - run: raco setup typed typed-racket typed-racket-test typed-scheme |
| 46 | + - name: Analyze changed files |
| 47 | + - run: xvfb-run racket -l- resyntax/cli analyze --local-git-repository . "origin/${GITHUB_BASE_REF}" --output-as-github-review >> ./resyntax-review.json |
| 48 | + - name: Upload analysis artifact |
| 49 | + |
| 50 | + with: |
| 51 | + name: resyntax-review |
| 52 | + path: resyntax-review.json |
0 commit comments