Skip to content

Commit df1dd3d

Browse files
SCANJLIB-240 Add Jira integration (#209)
1 parent 69c1f4c commit df1dd3d

File tree

5 files changed

+127
-0
lines changed

5 files changed

+127
-0
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<!--
2+
Only for standalone PRs without Jira issue in the PR title:
3+
* Replace this comment with Epic ID to create a new Task in Jira
4+
* Replace this comment with Issue ID to create a new Sub-Task in Jira
5+
* Ignore or delete this note to create a new Task in Jira without a parent
6+
-->
7+
18
Please be aware that we are not actively looking for feature contributions. The truth is that it's extremely difficult for someone outside SonarSource to comply with our roadmap and expectations. Therefore, we typically only accept minor cosmetic changes and typo fixes. If you would like to see a new feature, please create a new thread in the forum ["Suggest new features"](https://community.sonarsource.com/c/suggestions/features).
29

310
With that in mind, if you would like to submit a code contribution, make sure that you adhere to the following guidelines and all tests are passing:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Pull Request Closed
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
PullRequestMerged_job:
9+
name: Pull Request Merged
10+
runs-on: ubuntu-latest
11+
environment: jira
12+
permissions:
13+
id-token: write
14+
pull-requests: read
15+
# For external PR, ticket should be moved manually
16+
if: |
17+
github.event.pull_request.head.repo.full_name == github.repository
18+
&& github.event.pull_request.merged
19+
steps:
20+
- id: secrets
21+
uses: SonarSource/vault-action-wrapper@v3
22+
with:
23+
secrets: |
24+
development/kv/data/jira user | JIRA_USER;
25+
development/kv/data/jira token | JIRA_TOKEN;
26+
- uses: sonarsource/gh-action-lt-backlog/PullRequestClosed@v2
27+
with:
28+
github-token: ${{secrets.GITHUB_TOKEN}}
29+
jira-user: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_USER }}
30+
jira-token: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_TOKEN }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Pull Request Created
2+
3+
on:
4+
pull_request:
5+
types: ["opened"]
6+
7+
jobs:
8+
PullRequestCreated_job:
9+
name: Pull Request Created
10+
runs-on: ubuntu-latest
11+
environment: jira
12+
permissions:
13+
id-token: write
14+
# For external PR, ticket should be created manually
15+
if: |
16+
github.event.pull_request.head.repo.full_name == github.repository
17+
steps:
18+
- id: secrets
19+
uses: SonarSource/vault-action-wrapper@v3
20+
with:
21+
secrets: |
22+
development/github/token/{REPO_OWNER_NAME_DASH}-jira token | GITHUB_TOKEN;
23+
development/kv/data/jira user | JIRA_USER;
24+
development/kv/data/jira token | JIRA_TOKEN;
25+
- uses: sonarsource/gh-action-lt-backlog/PullRequestCreated@v2
26+
with:
27+
github-token: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }}
28+
jira-user: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_USER }}
29+
jira-token: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_TOKEN }}
30+
jira-project: SCANJLIB
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Request review
2+
3+
on:
4+
pull_request:
5+
types: ["review_requested"]
6+
7+
jobs:
8+
RequestReview_job:
9+
name: Request review
10+
runs-on: ubuntu-latest
11+
environment: jira
12+
permissions:
13+
id-token: write
14+
# For external PR, ticket should be moved manually
15+
if: |
16+
github.event.pull_request.head.repo.full_name == github.repository
17+
steps:
18+
- id: secrets
19+
uses: SonarSource/vault-action-wrapper@v3
20+
with:
21+
secrets: |
22+
development/github/token/{REPO_OWNER_NAME_DASH}-jira token | GITHUB_TOKEN;
23+
development/kv/data/jira user | JIRA_USER;
24+
development/kv/data/jira token | JIRA_TOKEN;
25+
- uses: sonarsource/gh-action-lt-backlog/RequestReview@v2
26+
with:
27+
github-token: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }}
28+
jira-user: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_USER }}
29+
jira-token: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_TOKEN }}

.github/workflows/SubmitReview.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Submit Review
2+
3+
on:
4+
pull_request_review:
5+
types: [submitted]
6+
7+
jobs:
8+
SubmitReview_job:
9+
name: Submit Review
10+
runs-on: ubuntu-latest
11+
environment: jira
12+
permissions:
13+
id-token: write
14+
pull-requests: read
15+
# For external PR, ticket should be moved manually
16+
if: |
17+
github.event.pull_request.head.repo.full_name == github.repository
18+
&& (github.event.review.state == 'changes_requested'
19+
|| github.event.review.state == 'approved')
20+
steps:
21+
- id: secrets
22+
uses: SonarSource/vault-action-wrapper@v3
23+
with:
24+
secrets: |
25+
development/kv/data/jira user | JIRA_USER;
26+
development/kv/data/jira token | JIRA_TOKEN;
27+
- uses: sonarsource/gh-action-lt-backlog/SubmitReview@v2
28+
with:
29+
github-token: ${{secrets.GITHUB_TOKEN}}
30+
jira-user: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_USER }}
31+
jira-token: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_TOKEN }}

0 commit comments

Comments
 (0)