chore(deps): bump org.assertj:assertj-bom from 3.26.3 to 3.27.0 #2015
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 Pull Request | |
on: | |
pull_request: | |
types: ["labeled"] | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
format-pr: | |
if: ${{ github.event.pull_request.merged == false && github.event.label.name == 'auto-format' }} | |
runs-on: ubuntu-latest | |
name: Apply format | |
steps: | |
- uses: tibdex/github-app-token@v1 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.QUARKUS_HILLA_BOT_ID }} | |
private_key: ${{ secrets.QUARKUS_HILLA_BOT_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
fetchref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: maven | |
- name: Apply changes | |
run: | | |
mvn -V -e -B -ntp -Pall-modules spotless:apply | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
id: commit-changes | |
with: | |
commit_message: "chore(auto-format): apply formatting" | |
commit_user_name: "quarkus-hilla-bot[bot]" | |
commit_user_email: "141157179+quarkus-hilla-bot[bot]@users.noreply.github.com" | |
- name: Update format labels on PR | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ steps.generate-token.outputs.token }} | |
script: | | |
const { owner, repo } = context.repo; | |
const prNumber = context.payload.pull_request.number; | |
if (${{ steps.commit-changes.outputs.changes_detected }} == 'true') { | |
// Remove the label if it exists | |
const existingLabels = await github.rest.issues.listLabelsOnIssue({ | |
owner, | |
repo, | |
issue_number: prNumber, | |
}); | |
const labelsToRemove = existingLabels.data.map(label => label.name).filter( label => label.startsWith("format:") ); | |
for (const labelToRemove of labelsToRemove) { | |
await github.rest.issues.removeLabel({ | |
owner, | |
repo, | |
issue_number: prNumber, | |
name: labelToRemove, | |
}); | |
} | |
} | |
await github.rest.issues.removeLabel({ | |
owner, | |
repo, | |
issue_number: prNumber, | |
name: "auto-format", | |
}); | |