@@ -32,45 +32,20 @@ jobs:
3232 - name : Extract PR Branch
3333 if : steps.check_command.outputs.valid == 'true'
3434 id : pr_details
35- uses : actions/github-script@v6
36- with :
37- script : |
38- const issue = context.payload.issue;
39-
40- // Check if the issue is related to a pull request
41- if (!issue.pull_request || !issue.pull_request.url) {
42- throw new Error("This comment is not associated with a pull request.");
43- }
44-
45- const pr_url = issue.pull_request.url;
46-
47- // Fetch pull request details using the GitHub API
48- const pr = await github.rest.pulls.get({
49- owner: context.repo.owner,
50- repo: context.repo.repo,
51- pull_number: context.payload.issue.number
52- });
53-
54- // Log the PR details for debugging
55- console.log("PR details:", pr.data);
56-
57- // Ensure we have the correct branch info
58- if (!pr.data.head || !pr.data.head.ref) {
59- throw new Error("Cannot find branch reference in the pull request.");
60- }
61-
62- const branch = pr.data.head.ref; // This is the branch name of the PR
63- console.log("PR branch:", branch);
64-
65- return { branch: branch };
66- result-encoding : json
35+ run : |
36+ # Extract the branch name from the PR context
37+ PR_BRANCH="${{ github.event.pull_request.head.ref }}"
38+ echo "PR branch: $PR_BRANCH"
39+
40+ # Set output variable for use in next steps
41+ echo "branch=$PR_BRANCH" >> $GITHUB_ENV
6742
6843
6944 # Step 4: Debug PR Branch
7045 - name : Debug PR Branch
7146 if : steps.check_command.outputs.valid == 'true'
7247 run : |
73- echo "Branch: ${{ steps.pr_details.outputs .branch }}"
48+ echo "Branch: ${{ env .branch }}"
7449
7550 # Step 5: Trigger Deploy Workflow
7651 - name : Trigger Deploy Workflow
0 commit comments