@@ -33,14 +33,19 @@ jobs:
3333 - name : Generate Issue Title
3434 id : create-title
3535 run : |
36+ echo "Starting Issue Title Generation..."
37+
3638 # Get the first day of the next month
3739 next_month=$(date -u -d "$(date +%Y-%m-01) +1 month" +%Y-%m-01)
40+ echo "Next month first day: $next_month"
3841
3942 # Find the first Monday of the next month
4043 first_monday=$(date -u -d "$next_month +$(( (8 - $(date -u -d "$next_month" +%u)) % 7 )) days" +%Y-%m-%d)
44+ echo "First Monday of next month: $first_monday"
4145
4246 # Calculate the third Monday by adding 14 days to the first Monday
4347 third_monday=$(date -u -d "$first_monday +14 days" +%Y-%m-%d)
48+ echo "Third Monday of next month: $third_monday"
4449
4550 # Output the issue title with the third Monday's date
4651 echo "title=Open Community Working Meeting ${third_monday} - 13:00 PT" >> "$GITHUB_OUTPUT"
@@ -94,36 +99,61 @@ jobs:
9499 auth: process.env.MY_TOKEN
95100 });
96101
97- console.log("Token:" + process.env.MY_TOKEN);
102+ console.log("Token available:", process.env.MY_TOKEN ? "Yes (masked)" : "No");
103+ console.log("Slack webhook available:", process.env.SLACK_WEBHOOK ? "Yes (masked)" : "No");
104+
98105 const ocwmnumber = ${{ steps.create-issue.outputs.issue-number }};
106+ console.log("Issue number:", ocwmnumber);
99107
108+ console.log("Fetching issue details...");
100109 const { data: ocwmissue } = await mygithub.request(`GET /repos/${context.repo.owner}/${context.repo.repo}/issues/${ ocwmnumber }`, {
101110 });
102111
103112 console.log("OCWM Issue:" + JSON.stringify(ocwmissue));
104113
105114 const newBody = `## ${ocwmissue.title}\n\n${ocwmissue.body.split('\n').slice(6).join('\n')}`;
106115
116+ console.log("Updating issue body...");
107117 await mygithub.request(`PATCH /repos/${context.repo.owner}/${context.repo.repo}/issues/${ ocwmnumber }`, {
108118 body: newBody,
109119 milestone: null,
110120 state: 'open',
111121 });
122+ console.log("Issue body updated successfully");
112123
113124 const newTitle = ocwmissue.title;
114125 const issueDate = newTitle.replace(/Open Community Working Meeting /g, "");
115126
127+ console.log("Extracted date from title:", issueDate);
128+ console.log("Issue URL for Slack:", ocwmissue.html_url);
129+
116130 // Notify Slack
117131 const SLACK_WEBHOOK_URL = process.env.SLACK_WEBHOOK;
118132 const SLACK_MESSAGE = `{
119133 "issue": "https://github.com/${context.repo.owner}/${context.repo.repo}/issues/${ocwmnumber}",
120134 "date": "${issueDate}"
121135 }`;
122136
123- await fetch(SLACK_WEBHOOK_URL, {
137+ console.log("Slack message payload:", SLACK_MESSAGE);
138+
139+ console.log("Sending Slack notification...");
140+ const slackResponse = await fetch(SLACK_WEBHOOK_URL, {
124141 method: 'POST',
125142 headers: {
126143 'Content-Type': 'application/json',
127144 },
128145 body: SLACK_MESSAGE,
129146 });
147+
148+ console.log("Slack response status:", slackResponse.status);
149+ console.log("Slack response status text:", slackResponse.statusText);
150+
151+ if (!slackResponse.ok) {
152+ const errorText = await slackResponse.text();
153+ console.error("Slack notification failed:", errorText);
154+ throw new Error(`Slack notification failed: ${slackResponse.status} ${slackResponse.statusText}`);
155+ } else {
156+ const responseText = await slackResponse.text();
157+ console.log("Slack notification sent successfully");
158+ console.log("Slack response:", responseText);
159+ }
0 commit comments