Skip to content

Commit c017cb8

Browse files
CopilotswissspidyCopilot
authored
Fix Welcome New Contributors workflow: replace broken first-interaction action (#234)
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Pascal Birchler <pascalb@google.com>
1 parent 721e91d commit c017cb8

1 file changed

Lines changed: 49 additions & 32 deletions

File tree

.github/workflows/reusable-welcome-new-contributors.yml

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,55 @@ jobs:
1616
result-encoding: string
1717
script: return String(context.payload.sender.type === 'Bot' || context.payload.sender.login?.endsWith('[bot]'));
1818

19-
- name: First Interaction
19+
- name: Check if first PR
20+
id: first-pr-check
2021
if: steps.bot-author-check.outputs.result != 'true'
21-
uses: actions/first-interaction@1c4688942c71f71d4f5502a26ea67c331730fa4d # v3
22+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
2223
with:
23-
repo_token: ${{ secrets.GITHUB_TOKEN }}
24-
# Not currently used but must be supplied.
25-
issue_message: |
26-
Hello! 👋
27-
pr_message: |
28-
Hello! 👋
29-
30-
Thanks for opening this pull request! Please check out our [contributing guidelines](https://make.wordpress.org/cli/handbook/contributions/contributing/). We appreciate you taking the initiative to contribute to this project.
31-
32-
Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
33-
34-
Here are some useful Composer commands to get you started:
35-
36-
* `composer install`: Install dependencies.
37-
* `composer test`: Run the full test suite.
38-
* `composer phpcs`: Check for code style violations.
39-
* `composer phpcbf`: Automatically fix code style violations.
40-
* `composer phpunit`: Run unit tests.
41-
* `composer behat`: Run behavior-driven tests.
42-
43-
To run a single Behat test, you can use the following command:
44-
45-
```bash
46-
# Run all tests in a single file
47-
composer behat features/some-feature.feature
48-
49-
# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
50-
composer behat features/some-feature.feature:123
51-
```
24+
result-encoding: string
25+
script: |
26+
const { data } = await github.rest.search.issuesAndPullRequests({
27+
q: `is:pr repo:${context.repo.owner}/${context.repo.repo} author:${context.payload.sender.login} created:<${context.payload.pull_request.created_at}`,
28+
per_page: 2,
29+
});
30+
return String(data.total_count === 0);
5231
53-
You can find a list of all available Behat steps in our [handbook](https://make.wordpress.org/cli/handbook/references/behat-steps/).
32+
- name: Welcome New Contributor
33+
if: steps.bot-author-check.outputs.result != 'true' && steps.first-pr-check.outputs.result == 'true'
34+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
35+
with:
36+
script: |
37+
const message = [
38+
'Hello! 👋',
39+
'',
40+
'Thanks for opening this pull request! Please check out our [contributing guidelines](https://make.wordpress.org/cli/handbook/contributions/contributing/). We appreciate you taking the initiative to contribute to this project.',
41+
'',
42+
"Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.",
43+
'',
44+
'Here are some useful Composer commands to get you started:',
45+
'',
46+
'* `composer install`: Install dependencies.',
47+
'* `composer test`: Run the full test suite.',
48+
'* `composer phpcs`: Check for code style violations.',
49+
'* `composer phpcbf`: Automatically fix code style violations.',
50+
'* `composer phpunit`: Run unit tests.',
51+
'* `composer behat`: Run behavior-driven tests.',
52+
'',
53+
'To run a single Behat test, you can use the following command:',
54+
'',
55+
'```bash',
56+
'# Run all tests in a single file',
57+
'composer behat features/some-feature.feature',
58+
'',
59+
'# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)',
60+
'composer behat features/some-feature.feature:123',
61+
'```',
62+
'',
63+
'You can find a list of all available Behat steps in our [handbook](https://make.wordpress.org/cli/handbook/references/behat-steps/).',
64+
].join('\n');
65+
await github.rest.issues.createComment({
66+
owner: context.repo.owner,
67+
repo: context.repo.repo,
68+
issue_number: context.payload.pull_request.number,
69+
body: message,
70+
});

0 commit comments

Comments
 (0)