Skip to content

Commit df4b9cf

Browse files
authored
ci: Use centralized reusable workflows from infra repo (#7)
Update common CI workflows to use centralized reusable workflows from kubestellar/infra repository: - greetings.yml - feedback.yml - stale.yml - pr-verifier.yml - add-help-wanted.yml - pr-verify-title.yml (added) - scorecard.yml (added) This reduces maintenance overhead and ensures consistency across all KubeStellar repositories. Signed-off-by: Andrew Anderson <andy@clubanderson.com>
1 parent 74d5b90 commit df4b9cf

File tree

7 files changed

+45
-116
lines changed

7 files changed

+45
-116
lines changed
Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,13 @@
1-
name: Add Help Wanted, Good First Issue, or Hacktober Fest Labels
1+
name: Add Help Wanted Labels
22

33
on:
44
issue_comment:
55
types: [created]
66

77
permissions:
8-
issues: write
8+
contents: read
99

1010
jobs:
11-
label-on-comment:
12-
if: github.event.comment.body == '/help-wanted' || github.event.comment.body == '/good-first-issue' || github.event.comment.body == '/hacktober-fest'
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Add label based on comment
16-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
17-
with:
18-
script: |
19-
const comment = context.payload.comment.body.trim().toLowerCase();
20-
const issue_number = context.payload.issue.number;
21-
const owner = context.repo.owner;
22-
const repo = context.repo.repo;
23-
24-
let label = null;
25-
if (comment === '/help-wanted') {
26-
label = 'help wanted';
27-
} else if (comment === '/good-first-issue') {
28-
label = 'good first issue';
29-
} else if (comment === '/hacktober-fest') {
30-
label = 'hacktober-fest';
31-
}
32-
33-
if (label) {
34-
await github.rest.issues.addLabels({
35-
owner,
36-
repo,
37-
issue_number,
38-
labels: [label],
39-
});
40-
console.log(`Added label: ${label}`);
41-
} else {
42-
console.log('No matching label to apply.');
43-
}
11+
label:
12+
uses: kubestellar/infra/.github/workflows/reusable-add-help-wanted.yml@main
13+
secrets: inherit

.github/workflows/feedback.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,10 @@ on:
44
pull_request:
55
types: [closed]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
feedback:
9-
if: github.event.pull_request.merged == true
10-
runs-on: ubuntu-latest
11-
permissions:
12-
pull-requests: write
13-
issues: write
14-
contents: read
15-
16-
steps:
17-
- name: Comment feedback request
18-
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9
19-
with:
20-
token: ${{ secrets.GITHUB_TOKEN }}
21-
issue-number: ${{ github.event.pull_request.number }}
22-
body: |
23-
🎉 Thank you for your contribution! Your PR has been successfully merged.
24-
25-
We’d love to hear your thoughts to help improve KubeStellar.
26-
Please take a moment to fill out our short feedback survey:
27-
28-
https://kubestellar.io/survey
12+
uses: kubestellar/infra/.github/workflows/reusable-feedback.yml@main
13+
secrets: inherit

.github/workflows/greetings.yml

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,6 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
greeting:
14-
runs-on: ubuntu-latest
15-
permissions:
16-
issues: write
17-
pull-requests: write
18-
steps:
19-
- uses: actions/first-interaction@1c4688942c71f71d4f5502a26ea67c331730fa4d
20-
with:
21-
repo-token: ${{ secrets.GITHUB_TOKEN }}
22-
issue-message: |
23-
Thank you for contributing your first Issue to KubeStellar. We are delighted to have you in our Universe!
24-
25-
To assign yourself to this issue, please use the slash command:
26-
```
27-
/assign
28-
```
29-
30-
This will automatically assign the issue to you via our Prow bot. You can also use `/unassign` to remove yourself from an issue.
31-
32-
Thank you for your interest in contributing to KubeStellar!
33-
pr-message: "Thank you for submitting your first Pull Request to KubeStellar. We are delighted to have you in our Universe!"
13+
greet:
14+
uses: kubestellar/infra/.github/workflows/reusable-greetings.yml@main
15+
secrets: inherit

.github/workflows/pr-verifier.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@ on:
55
types: [opened, edited, reopened, synchronize]
66

77
jobs:
8-
verify-pr:
9-
name: verify PR contents
10-
# Skip verification for dependabot PRs - they use different title conventions
11-
if: github.actor != 'dependabot[bot]'
12-
permissions:
13-
checks: write
14-
pull-requests: read
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Verifier action
18-
id: verifier
19-
uses: kubernetes-sigs/kubebuilder-release-tools@v0.4.3
20-
with:
21-
github_token: ${{ secrets.GITHUB_TOKEN }}
8+
verify:
9+
uses: kubestellar/infra/.github/workflows/reusable-pr-verifier.yml@main
10+
secrets: inherit
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: "PR Title Verifier"
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize, reopened]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
verify:
12+
uses: kubestellar/infra/.github/workflows/reusable-pr-verify-title.yml@main
13+
secrets: inherit

.github/workflows/scorecard.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: OpenSSF Scorecard
2+
3+
on:
4+
branch_protection_rule:
5+
schedule:
6+
- cron: '0 6 * * 1'
7+
push:
8+
branches: [ "main" ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
analysis:
13+
uses: kubestellar/infra/.github/workflows/reusable-scorecard.yml@main
14+
secrets: inherit

.github/workflows/stale.yml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,5 @@ on:
77

88
jobs:
99
stale:
10-
runs-on: ubuntu-latest
11-
permissions:
12-
issues: write
13-
steps:
14-
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e
15-
with:
16-
days-before-issue-stale: 90
17-
days-before-issue-close: 90
18-
stale-issue-label: lifecycle/stale
19-
stale-pr-label: lifecycle/stale
20-
stale-issue-message: >-
21-
This issue has been automatically marked as stale because it has not had recent activity.
22-
It will be closed in 90 days if no further activity occurs. If this is still relevant,
23-
please add a comment to keep it open.
24-
close-issue-message: >-
25-
Closing this issue due to prolonged inactivity after being marked as stale. If this remains
26-
an active concern, feel free to reopen or create a new issue with updated details.
27-
close-issue-label: lifecycle/auto-closed
28-
days-before-pr-stale: -1
29-
days-before-pr-close: -1
30-
exempt-issue-labels: >-
31-
security,bug,enhancement,good first issue,help wanted,hacktober-fest,
32-
lifecycle/frozen
33-
exempt-pr-labels: >-
34-
security,lifecycle/frozen
35-
exempt-all-assignees: true
10+
uses: kubestellar/infra/.github/workflows/reusable-stale.yml@main
11+
secrets: inherit

0 commit comments

Comments
 (0)