Skip to content

Commit 204970d

Browse files
authored
ci: amend Welcome 1st time contrib Beta2 (#1843)
* ci: amend Welcome 1st time contrib Beta2 Signed-off-by: Matteo Mortari <matteo.mortari@gmail.com> * changes taking inspiration from KF SDK see also: kubeflow/sdk#117 Signed-off-by: Matteo Mortari <matteo.mortari@gmail.com> --------- Signed-off-by: Matteo Mortari <matteo.mortari@gmail.com>
1 parent d3a4f34 commit 204970d

1 file changed

Lines changed: 73 additions & 39 deletions

File tree

Lines changed: 73 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,85 @@
1-
# goal: this is meant to remind maintainers/approvers to add labels to ensure all tests are executed before merging
2-
# and avoid merging without realizing that required tests has not been run; complementary to bulletpoint in template: https://github.com/kubeflow/model-registry/blame/de5f225d96a4daeca77506d233082b1c4ea5afa3/.github/pull_request_template.md#L21
3-
name: Welcome first-time contributors (Beta)
1+
name: Welcome first-time contributors (Beta2)
2+
43
on:
5-
pull_request_target:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
issues:
610
types:
711
- opened
12+
813
permissions: # set contents: read at top-level, per OpenSSF ScoreCard rule TokenPermissionsID
914
contents: read
1015

11-
# do NOT: add actions/checkout to this flow, add-third party scripts, or auto-trigger CI jobs
1216
jobs:
1317
welcome:
18+
runs-on: ubuntu-latest
1419
permissions:
1520
pull-requests: write
16-
runs-on: ubuntu-latest
21+
issues: write
1722
steps:
18-
- name: Check contributor status
19-
id: check_1st_time_contrib
20-
uses: actions/github-script@v8
21-
with:
22-
script: |
23-
const { data: pr } = await github.rest.pulls.get({
24-
owner: context.repo.owner,
25-
repo: context.repo.repo,
26-
pull_number: context.issue.number
27-
});
28-
const isFirstTimeContributor = pr.user.contributions === 0;
29-
console.log(`First-time contributor status: ${isFirstTimeContributor}`);
30-
core.setOutput('isFirstTimeContributor', isFirstTimeContributor.toString());
31-
32-
- name: Log contributor status (isFirstTimeContributor true)
33-
if: steps.check_1st_time_contrib.outputs.isFirstTimeContributor == 'true'
34-
run: echo "First-time contributor status is ${{ steps.check_1st_time_contrib.outputs.isFirstTimeContributor }}"
35-
36-
- name: Log contributor status (isFirstTimeContributor false)
37-
if: steps.check_1st_time_contrib.outputs.isFirstTimeContributor == 'false'
38-
run: echo "First-time contributor status is ${{ steps.check_1st_time_contrib.outputs.isFirstTimeContributor }}"
39-
40-
- name: Add a comment to the PR if first time contributor
41-
if: steps.check_1st_time_contrib.outputs.isFirstTimeContributor == 'true'
42-
uses: actions/github-script@v8
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install PyYAML
27+
run: pip3 install pyyaml
28+
29+
- name: Extract approvers from OWNERS file
30+
id: set-approvers
31+
run: |
32+
python3 << 'EOF'
33+
import yaml
34+
import os
35+
36+
with open('OWNERS', 'r') as f:
37+
data = yaml.safe_load(f)
38+
39+
approvers = data.get('approvers', [])
40+
result = ' '.join([f'@{approver}' for approver in approvers])
41+
42+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
43+
f.write(f'approvers={result}\n')
44+
45+
print(f'Extracted approvers: {result}')
46+
EOF
47+
- name: Log approvers
48+
run: |
49+
echo "Approvers: ${{ steps.set-approvers.outputs.approvers }}"
50+
51+
- name: Welcome first-time contributors message
52+
uses: actions/first-interaction@v3
4353
with:
44-
script: |
45-
github.rest.issues.createComment({
46-
issue_number: context.issue.number,
47-
owner: context.repo.owner,
48-
repo: context.repo.repo,
49-
body: "Maintainers: let's ensure the label `ok-to-test` has been maintained and all the tests have been executed before merging.<br/><br/>Thank you for your first Pull Request! 🎉🎉"
50-
})
51-
# do NOT: add actions/checkout to this flow, add-third party scripts, or auto-trigger CI jobs
54+
repo_token: ${{ secrets.GITHUB_TOKEN }}
55+
issue_message: |
56+
🎉 **Welcome to the Kubeflow Model Registry!** 🎉
57+
Thanks for opening your first issue! We're happy to have you as part of our community 🚀
58+
59+
**Here's what happens next:**
60+
- If you'd like to contribute to this issue, check out our [Contributing Guide](https://github.com/kubeflow/model-registry/blob/main/CONTRIBUTING.md) for repo-specific guidelines and the [Kubeflow Contributor Guide](https://www.kubeflow.org/docs/about/contributing/) for general community standards
61+
- Our team will review your issue soon!
62+
63+
**Join the community:**
64+
- **Slack**: Join our [Slack channels](https://www.kubeflow.org/docs/about/community/#slack-channels)
65+
- **Meetings**: Attend the [Kubeflow](https://www.kubeflow.org/docs/about/community/#list-of-available-meetings) online calls
66+
67+
Feel free to ask questions in the comments if you need any help or clarification!
68+
Thanks again for contributing to Kubeflow! 🙏
69+
pr_message: |
70+
🎉 **Welcome to the Kubeflow Model Registry!** 🎉
71+
Thanks for opening your first PR! We're happy to have you as part of our community 🚀
72+
73+
**Here's what happens next:**
74+
- If you haven't already, please check out our [Contributing Guide](https://github.com/kubeflow/model-registry/blob/main/CONTRIBUTING.md) for repo-specific guidelines and the [Kubeflow Contributor Guide](https://www.kubeflow.org/docs/about/contributing/) for general community standards
75+
- Our team will review your PR soon!
76+
77+
**Join the community:**
78+
- **Slack**: Join our [Slack channels](https://www.kubeflow.org/docs/about/community/#slack-channels)
79+
- **Meetings**: Attend the [Kubeflow](https://www.kubeflow.org/docs/about/community/#list-of-available-meetings) online calls
80+
81+
Feel free to ask questions in the comments if you need any help or clarification!
82+
Thanks again for contributing to Kubeflow! 🙏
83+
84+
Note for: ${{ steps.set-approvers.outputs.approvers }}
85+
Kindly ensure the label `ok-to-test` has been added to the PR, and all the tests have been executed before merging!

0 commit comments

Comments
 (0)