1- name : PR Automated Comments Test
1+ name : Test PR Automated Comments
22
33on :
4- # Automatic triggers
5- pull_request_target :
6- types : [opened, ready_for_review, closed]
7-
84 # Manual trigger for testing
95 workflow_dispatch :
106 inputs :
2117 # When manually triggered, we need to simulate the PR event context
2218 prepare-test-context :
2319 name : Prepare Test Context
24- if : github.event_name == 'workflow_dispatch'
2520 runs-on : ubuntu-latest
2621 outputs :
2722 is_external : ' true'
@@ -41,25 +36,12 @@ jobs:
4136 echo "is_first_pr=false" >> $GITHUB_OUTPUT
4237 fi
4338
44- # Real workflow for actual PR events
45- pr-comments-real :
46- name : PR Comments (Real)
47- if : github.event_name == 'pull_request_target'
48- uses : ./.github/workflows/pr-auto-comments.yml@${{ github.ref_name }}
49- with :
50- org_name : " RequestNetwork"
51- # You can specify additional internal users here if needed
52- additional_internal_users : " "
53- # Use default messages
54- secrets :
55- token : ${{ secrets.GITHUB_TOKEN }}
56-
5739 # Test workflow for manual triggering - using the actual reusable workflow
5840 first-pr-comment-test :
5941 name : First PR Comment (Test)
6042 needs : prepare-test-context
61- if : github.event_name == 'workflow_dispatch' && needs.prepare-test-context.outputs.event_type == 'opened'
62- uses : ./.github/workflows/pr-auto-comments.yml@${{ github.ref_name }}
43+ if : needs.prepare-test-context.outputs.event_type == 'opened'
44+ uses : ./.github/workflows/pr-auto-comments.yml
6345 with :
6446 org_name : " RequestNetwork"
6547 first_pr_comment : " Hello @{{username}}, thank you for submitting your first pull request to the {{repository}} repository. We value your contribution and encourage you to review our contribution guidelines to ensure your submission meets our standards. Please note that every merged PR is automatically enrolled in our Best PR Initiative, offering a chance to win $500 each quarter. Our team is available via GitHub Discussions or Discord if you have any questions. Welcome aboard! (TEST)"
7153 ready-for-review-comment-test :
7254 name : Ready for Review Comment (Test)
7355 needs : prepare-test-context
74- if : github.event_name == 'workflow_dispatch' && needs.prepare-test-context.outputs.event_type == 'ready_for_review'
75- uses : ./.github/workflows/pr-auto-comments.yml@${{ github.ref_name }}
56+ if : needs.prepare-test-context.outputs.event_type == 'ready_for_review'
57+ uses : ./.github/workflows/pr-auto-comments.yml
7658 with :
7759 org_name : " RequestNetwork"
7860 first_pr_comment : " "
8466 merged-pr-comment-test :
8567 name : Merged PR Comment (Test)
8668 needs : prepare-test-context
87- if : github.event_name == 'workflow_dispatch' && needs.prepare-test-context.outputs.event_type == 'merged'
88- uses : ./.github/workflows/pr-auto-comments.yml@${{ github.ref_name }}
69+ if : needs.prepare-test-context.outputs.event_type == 'merged'
70+ uses : ./.github/workflows/pr-auto-comments.yml
8971 with :
9072 org_name : " RequestNetwork"
9173 first_pr_comment : " "
9880 notify-test-completion :
9981 name : Notify Test Completion
10082 needs : [prepare-test-context]
101- if : github.event_name == 'workflow_dispatch'
10283 runs-on : ubuntu-latest
10384 steps :
10485 - name : Create notification issue comment
@@ -110,22 +91,30 @@ jobs:
11091 const repoName = context.repo.repo;
11192 const orgName = context.repo.owner;
11293
113- const issue_number = context.issue.number || 1;
94+ console.log(`Running test for ${eventType} event in ${orgName}/${repoName}`);
95+
96+ try {
97+ const issue_number = 1; // Use issue #1 as fallback
11498
115- await github.rest.issues.createComment({
116- owner: context.repo.owner,
117- repo: context.repo.repo,
118- issue_number: issue_number,
119- body: `## Test for "${eventType}" PR Event Initiated
99+ await github.rest.issues.createComment({
100+ owner: context.repo.owner,
101+ repo: context.repo.repo,
102+ issue_number: issue_number,
103+ body: `## Test for "${eventType}" PR Event Initiated
120104
121- A test of the \`${eventType}\` PR event comment has been initiated.
105+ A test of the \`${eventType}\` PR event comment has been initiated.
122106
123- **Note:** Since this is a manual test, this will use hard-coded test variables:
124- - Repository: ${repoName}
125- - Organization: ${orgName}
126- - Testing as an external contributor
107+ **Note:** Since this is a manual test, this will use hard-coded test variables:
108+ - Repository: ${repoName}
109+ - Organization: ${orgName}
110+ - Testing as an external contributor
127111
128- Check the [Actions tab](https://github.com/${orgName}/${repoName}/actions/workflows/repo- pr-comments.yml) to see the workflow execution.
112+ Check the [Actions tab](https://github.com/${orgName}/${repoName}/actions/workflows/pr-auto- comments-test .yml) to see the workflow execution.
129113
130- *This is a notification from the manual test trigger.*`
131- });
114+ *This is a notification from the manual test trigger.*`
115+ });
116+ console.log('Created notification comment on issue #1');
117+ } catch (error) {
118+ console.log('Error creating comment:', error);
119+ console.log('Continuing without creating a comment');
120+ }
0 commit comments