|
| 1 | +name: Update Rule Metadata |
| 2 | +run-name: Update Rule Metadata |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + rule-api-version: |
| 8 | + description: Version of the rule-api tooling to be used for the workflow. |
| 9 | + type: string |
| 10 | + branch: |
| 11 | + description: Branch to run the check against and create the PR for. |
| 12 | + type: string |
| 13 | + default: 'master' |
| 14 | + rspec-branch: |
| 15 | + description: | |
| 16 | + Branch of the rspec repository to be used. |
| 17 | + If not specified, the 'master' branch of the rspec repository will be used. |
| 18 | + type: string |
| 19 | + default: 'master' |
| 20 | + schedule: |
| 21 | + - cron: '0 5 * * 1-5' |
| 22 | + pull_request: |
| 23 | + |
| 24 | +jobs: |
| 25 | + update-rule-metadata: |
| 26 | + name: Update Rule Metadata |
| 27 | + runs-on: sonar-xs-public |
| 28 | + permissions: |
| 29 | + id-token: write # required by SonarSource/release-github-actions/update-rule-metadata |
| 30 | + contents: write # required by SonarSource/release-github-actions/update-rule-metadata |
| 31 | + pull-requests: write # required by SonarSource/release-github-actions/update-rule-metadata |
| 32 | + steps: |
| 33 | + - uses: SonarSource/release-github-actions/update-rule-metadata@df9d4e1b77eef858910d277bb110114ba4c4c044 |
| 34 | + id: update-rule-metadata |
| 35 | + with: |
| 36 | + rule-api-version: ${{ github.event.inputs.rule-api-version}} |
| 37 | + branch: ${{ github.event.inputs.branch }} |
| 38 | + rspec-branch: ${{ github.event.inputs.rspec-branch }} |
| 39 | + |
| 40 | + - name: Workflow summary |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + echo "## Rule Metadata Update Summary" >> $GITHUB_STEP_SUMMARY |
| 44 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 45 | + echo -e "${{ steps.update-rule-metadata.outputs.summary }}" >> $GITHUB_STEP_SUMMARY |
| 46 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 47 | +
|
| 48 | + if [[ "${{ steps.update-rule-metadata.outputs.has-changes }}" == "true" ]]; then |
| 49 | + echo "Rule metadata changes were detected. PR was created." >> $GITHUB_STEP_SUMMARY |
| 50 | + echo "${{ steps.update-rule-metadata.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY |
| 51 | + else |
| 52 | + echo "No rule metadata changes detected. No PR was created." >> $GITHUB_STEP_SUMMARY |
| 53 | + fi |
0 commit comments