Sync SonarCloud Issues #2
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: Sync SonarCloud Issues | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: "Simular sem criar issues" | |
| required: false | |
| default: "false" | |
| schedule: | |
| - cron: "30 19 * * 1" | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| clean: true | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y jq | |
| - name: Setup GitHub CLI | |
| run: | | |
| curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | |
| sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg | |
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | |
| sudo apt-get update && sudo apt-get install -y gh | |
| - name: Authenticate GitHub CLI | |
| run: echo "${ secrets.GITHUB_TOKEN }" | gh auth login --with-token | |
| - name: Run sync script | |
| env: | |
| SONAR_TOKEN: ${ secrets.SONAR_TOKEN } | |
| GH_TOKEN: ${ secrets.GITHUB_TOKEN } | |
| DRY_RUN: ${ github.event.inputs.dry_run } | |
| run: | | |
| chmod +x scripts/sync_sonar_issues.sh | |
| bash scripts/sync_sonar_issues.sh | |
| - name: Upload sync report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sonar-sync-report-${ github.run_number } | |
| path: sync_report.log | |
| retention-days: 30 | |
| if-no-files-found: ignore |