Skip to content

Commit 33090e5

Browse files
SONARJAVA-6114 Provide GitHub token with RSpec access to rule-api.jar (#5470)
1 parent bfe1aac commit 33090e5

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/UpdateRuleMetadata.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Update Rule Metadata
33
on: workflow_dispatch
44

55
env:
6-
PR_BRANCH_NAME: gh-action/update-rule-metadata
6+
PR_BRANCH_NAME: "gh-action/update-rule-metadata.${{ github.run_id }}"
77

88
jobs:
99
UpdateRuleMetadata_job:
@@ -38,12 +38,22 @@ jobs:
3838
distribution: 'temurin'
3939
java-version: '21'
4040

41+
- name: Getting Vault Secrets
42+
id: secrets
43+
uses: SonarSource/vault-action-wrapper@320bd31b03e5dacaac6be51bbbb15adf7caccc32 # v3.1.0
44+
with:
45+
secrets: |
46+
development/github/token/{REPO_OWNER_NAME_DASH}-rspec token | GITHUB_TOKEN_RSPEC;
47+
4148
- name: Update Files
49+
env:
50+
GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN_RSPEC }}
4251
run: |
4352
java -jar "/tmp/rule-api.jar" update
4453
sed --in-place='' -e 's/rule:java:S3649/rule:javasecurity:S3649/g' 'sonar-java-plugin/src/main/resources/org/sonar/l10n/java/rules/java/S2077.html'
4554
4655
- name: Create PR
56+
id: create-pr
4757
env:
4858
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4959
run: |
@@ -52,4 +62,10 @@ jobs:
5262
git checkout -b "${{ env.PR_BRANCH_NAME }}"
5363
git commit -m 'Update rule metadata' -a
5464
git push --set-upstream origin "${{ env.PR_BRANCH_NAME }}"
55-
gh pr create -B master --title 'Update rule metadata' --body ''
65+
URL=$(gh pr create -B master --title 'Update rule metadata' --body '')
66+
echo "url=${URL}" >> $GITHUB_OUTPUT
67+
68+
- name: Summary
69+
run: |
70+
echo "Generated ${{steps.create-pr.outputs.url}}." >> $GITHUB_STEP_SUMMARY
71+
echo "Tip: close and reopen the PR to trigger CI. " >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)