i forgor to format #116
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Format PR on comment | |
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@v4 | |
with: | |
script: | | |
const {owner, repo} = context.issue | |
github.reactions.createForIssueComment({ | |
owner, | |
repo, | |
comment_id: context.payload.comment.id, | |
content: "rocket", | |
}); | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.FORMATTER_PAT }} | |
- 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.FORMATTER_PAT }}" | |
NUMBER: ${{ github.event.issue.number }} | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- 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 add -A | |
git diff-index --quiet HEAD || git commit -m "Formatting fixes" | |
git push | |
- name: React Party Hat | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
const {owner, repo} = context.issue | |
github.reactions.createForIssueComment({ | |
owner, | |
repo, | |
comment_id: context.payload.comment.id, | |
content: "hooray", | |
}); |