Skip to content

Commit 4ed667e

Browse files
authored
update sonar workflow (#24)
* update sonar workflow
1 parent 8221d2f commit 4ed667e

2 files changed

Lines changed: 5 additions & 32 deletions

File tree

.github/workflows/auto-close-external-prs.yml

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ name: "Auto-Close External PRs"
33
on:
44
pull_request_target:
55
types: [opened]
6-
workflow_dispatch:
76

87
jobs:
98
close-on-open:
10-
if: github.event_name == 'pull_request_target' && github.event.pull_request.user.login != github.repository_owner
9+
if: github.event.pull_request.user.login != github.repository_owner
1110
runs-on: ubuntu-latest
1211
permissions:
1312
pull-requests: write
@@ -28,31 +27,4 @@ jobs:
2827
repo: context.repo.repo,
2928
pull_number: pr,
3029
state: "closed"
31-
});
32-
33-
sweep-existing:
34-
if: github.event_name == 'workflow_dispatch'
35-
runs-on: ubuntu-latest
36-
permissions:
37-
pull-requests: write
38-
issues: write
39-
steps:
40-
- uses: actions/github-script@v7
41-
with:
42-
script: |
43-
const owner = context.repo.owner;
44-
const repo = context.repo.repo;
45-
const prs = await github.paginate(github.rest.pulls.list, {
46-
owner, repo, state: 'open', per_page: 100
47-
});
48-
for (const pr of prs) {
49-
if (pr.user.login === owner) continue;
50-
core.info(`Closing PR #${pr.number} by ${pr.user.login}`);
51-
await github.rest.issues.createComment({
52-
owner, repo, issue_number: pr.number,
53-
body: "Thanks for the interest! This repository isn't currently accepting external contributions as I am actively experimenting with different approaches and want to avoid merge conflicts. Therefore, this PR is being closed automatically by Github Bot."
54-
});
55-
await github.rest.pulls.update({
56-
owner, repo, pull_number: pr.number, state: "closed"
57-
});
58-
}
30+
});

.github/workflows/sonar.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
on:
22
# Triggered on completion of the Build workflow so we can consume its
3-
# coverage artifact. workflow_run fires regardless of whether the upstream
4-
# was triggered by push or pull_request.
3+
# coverage artifact. Limited to runs against main so we only scan the
4+
# mainline; PR builds don't trigger Sonar.
55
workflow_run:
66
workflows: ["Build"]
77
types: [completed]
8+
branches: [main]
89

910
name: SonarCloud Scan
1011

0 commit comments

Comments
 (0)