@@ -17,12 +17,19 @@ jobs:
1717 with :
1818 script : |
1919 const comment = context.payload.comment.body;
20+ console.log("Comment received:", comment);
2021 if (comment.trim() === '/deploy-pre') {
22+ console.log("Command `/deploy-pre` found.");
2123 return { valid: true };
2224 }
25+ console.log("No valid command found.");
2326 return { valid: false };
2427 result-encoding : json
2528
29+ # Debug: Log the output of check_command
30+ - name : Debug Command Check
31+ run : echo "Valid command: ${{ steps.check_command.outputs.valid }}"
32+
2633 # Step 2: Get Branch from PR
2734 - name : Extract PR Branch
2835 if : steps.check_command.outputs.valid == 'true'
3441 if (!pr) {
3542 throw new Error("This command can only be used on a pull request.");
3643 }
44+ console.log("PR branch:", pr.head.ref);
3745 return pr.head.ref;
3846 result-encoding : string
3947
48+ # Debug: Log PR branch
49+ - name : Debug PR Branch
50+ if : steps.check_command.outputs.valid == 'true'
51+ run : echo "Branch: ${{ steps.pr_details.outputs.result }}"
52+
4053 # Step 3: Trigger Deploy Workflow
4154 - name : Trigger Deploy Workflow
4255 if : steps.check_command.outputs.valid == 'true'
4659 github.rest.actions.createWorkflowDispatch({
4760 owner: context.repo.owner,
4861 repo: context.repo.repo,
49- workflow_id: "deploy-pre.yml",
62+ workflow_id: "deploy-pre.yml", # Replace with your deployment workflow filename
5063 ref: "${{ steps.pr_details.outputs.result }}"
5164 })
65+ console.log("Triggered deploy-pre workflow for branch:", "${{ steps.pr_details.outputs.result }}");
5266
5367 # Step 4: Post Confirmation Comment
5468 - name : Post Comment to PR
6377 issue_number: issue_number,
6478 body: `✅ Workflow \`deploy-pre.yml\` has been triggered for branch \`${{ steps.pr_details.outputs.result }}\`.`
6579 });
80+ console.log("Commented back to PR:", issue_number);
0 commit comments