name: Comment Commands on: issue_comment: types: [ created ] jobs: format: if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/format') runs-on: ubuntu-22.04 steps: - name: React Rocket uses: actions/github-script@v6 with: script: | const {owner, repo} = context.issue github.rest.reactions.createForIssueComment({ owner, repo, comment_id: context.payload.comment.id, content: "rocket", }); - uses: actions/checkout@v3 with: token: ${{ secrets.COMMENT_COMMAND_PAT_TOKEN }} - name: Fetch all history and metadata run: | git fetch --prune --unshallow git checkout -b pr git branch -f main origin/main - name: Checkout PR run: | gh pr checkout $NUMBER env: GITHUB_TOKEN: "${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}" NUMBER: ${{ github.event.issue.number }} - name: Set up Python 3.8 uses: actions/setup-python@v4 with: python-version: 3.8 - name: Setup Java uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: 11 - name: Install wpiformat run: pip3 install wpiformat - name: Run wpiformat run: wpiformat - name: Run spotlessApply run: ./gradlew spotlessApply - name: Commit run: | # Set credentials git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" # Commit git commit -am "Formatting fixes" git push