@@ -14,27 +14,12 @@ jobs:
1414 pull-requests : write
1515 contents : write
1616 steps :
17- - name : Generate a token
18- id : generate-token
19- uses : actions/create-github-app-token@v1
20- with :
21- app-id : ${{ vars.RESYNTAX_APP_ID }}
22- private-key : ${{ secrets.RESYNTAX_APP_PRIVATE_KEY }}
23- - name : Get GitHub App User ID
24- id : get-user-id
25- run : echo "user-id=$(gh api "/users/${{ steps.generate-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
26- env :
27- GH_TOKEN : ${{ steps.generate-token.outputs.token }}
2817 - name : Checkout code
291830- # See https://github.com/actions/checkout/issues/118.
31- with :
32- fetch-depth : 0
3319 - name : Install Racket
34203521 with :
3622 version : current
37- packages : resyntax
3823 local_catalogs : $GITHUB_WORKSPACE
3924 dest : ' "${HOME}/racketdist-current-CS"'
4025 sudo : never
@@ -44,30 +29,10 @@ jobs:
4429 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
4530 - name : Install local packages
4631 run : raco setup typed typed-racket typed-racket-test typed-scheme
47- - name : Create a new branch
48- run : git checkout -b autofix-${{ github.run_number }}-${{ github.run_attempt }}
49- - name : Run Resyntax
50- run : racket -l- resyntax/cli fix --directory . --max-fixes 20 --max-modified-files 3 --output-as-commit-message >> /tmp/resyntax-output.txt
51- - name : Create pull request
52- 32+ - name : Create a Resyntax pull request
33+ 5334 with :
54- github-token : ${{ steps.generate-token.outputs.token }}
55- script : |
56- const { readFile, writeFile } = require('fs/promises');
57- const commitMessageBody = await readFile('/tmp/resyntax-output.txt', { encoding: 'utf8' });
58- const commitMessageTitle = "Automated Resyntax fixes";
59- const commitMessage = commitMessageTitle + "\n\n" + commitMessageBody;
60- await writeFile('/tmp/resyntax-commit-message.txt', commitMessage);
61- await exec.exec('git config user.name "${{ steps.generate-token.outputs.app-slug }}[bot]"');
62- await exec.exec('git config user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.generate-token.outputs.app-slug }}[bot]@users.noreply.github.com"');
63- await exec.exec('git commit --all --file=/tmp/resyntax-commit-message.txt');
64- await exec.exec('git push --set-upstream origin autofix-${{ github.run_number }}-${{ github.run_attempt }}');
65- await github.rest.pulls.create({
66- owner: context.repo.owner,
67- repo: context.repo.repo,
68- title: commitMessageTitle,
69- head: "autofix-${{ github.run_number }}-${{ github.run_attempt }}",
70- base: "master",
71- body: commitMessageBody,
72- maintainer_can_modify: true,
73- });
35+ private-key : ${{ secrets.RESYNTAX_APP_PRIVATE_KEY }}
36+ max-fixes : ' 50'
37+ max-modified-files : ' 20'
38+ max-modified-lines : ' 500'
0 commit comments