π¨ Modify api endpoint #149
This file contains hidden or 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: Validate PR | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-analyze: | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:7 | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: 'zulu' | |
| - name: Cache SonarQube packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
| restore-keys: ${{ runner.os }}-gradle | |
| - name: Build and analyze | |
| env: | |
| SONAR_TOKEN: ${{ env.SONAR_TOKEN }} | |
| run: chmod +x gradlew && ./gradlew build sonar --info | |
| - name: Send Success Message | |
| if: ${{ success() }} | |
| uses: Ilshidur/[email protected] | |
| with: | |
| args: "We got a new pull request π" | |
| env: | |
| DISCORD_WEBHOOK: ${{ env.DISCORD_WEBHOOK }} | |
| DISCORD_EMBEDS: | | |
| [ | |
| { | |
| "author": { | |
| "name": "${{ github.event.pull_request.user.login }}" | |
| }, | |
| "title": "#${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}", | |
| "color": 10478271, | |
| "description": "[View on GitHub](${{ github.event.pull_request.html_url }})", | |
| "fields": [ | |
| { | |
| "name": "Base Branch", | |
| "value": "${{ github.base_ref }}", | |
| "inline": true | |
| }, | |
| { | |
| "name": "Compare Branch", | |
| "value": "${{ github.head_ref }}", | |
| "inline": true | |
| } | |
| ] | |
| } | |
| ] | |
| - name: Send Failure Message | |
| if: ${{ failure() }} | |
| uses: Ilshidur/[email protected] | |
| with: | |
| args: "The pull request failed. Please resolve the issue and try again π½" | |
| env: | |
| DISCORD_WEBHOOK: ${{ env.DISCORD_WEBHOOK }} | |
| DISCORD_EMBEDS: | | |
| [ | |
| { | |
| "author": { | |
| "name": "${{ github.event.pull_request.user.login }}" | |
| }, | |
| "title": "#${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}", | |
| "color": 13458524, | |
| "description": "[View on GitHub](${{ github.event.pull_request.html_url }})", | |
| "fields": [ | |
| { | |
| "name": "Base Branch", | |
| "value": "${{ github.base_ref }}", | |
| "inline": true | |
| }, | |
| { | |
| "name": "Compare Branch", | |
| "value": "${{ github.head_ref }}", | |
| "inline": true | |
| } | |
| ] | |
| } | |
| ] |