Skip to content

Commit 5434491

Browse files
Added logs on slack ocwm notification workflows for debugging
1 parent 49380fa commit 5434491

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed

.github/workflows/ocwm-creator.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

.github/workflows/ocwm-reminders.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,63 @@ jobs:
6767
auth: process.env.MY_TOKEN
6868
});
6969
70+
console.log("Starting Send reminders step");
71+
console.log("Token available:", process.env.MY_TOKEN ? "Yes (masked)" : "No");
72+
console.log("Slack webhook available:", process.env.SLACK_WEBHOOK ? "Yes (masked)" : "No");
73+
console.log("Owner:", process.env.OWNER);
74+
console.log("Repository:", process.env.REPO);
75+
console.log("OCWM Label:", process.env.OCWM_LABEL);
76+
7077
let targetLabel = encodeURIComponent(process.env.OCWM_LABEL);
7178
79+
console.log("Fetching working meetings from GitHub API...");
7280
const { data: workMeetings } = await mygithub.request(`GET /repos/${process.env.OWNER}/${process.env.REPO}/issues?labels=${targetLabel}&per_page=1`, {
7381
})
7482
75-
const issueNumber = workMeetings[0].number
83+
console.log("Number of work meetings found:", workMeetings.length);
84+
85+
if (workMeetings.length === 0) {
86+
console.error("No working meetings found with label:", process.env.OCWM_LABEL);
87+
throw new Error("No working meetings found");
88+
}
89+
90+
const issueNumber = workMeetings[0].number;
7691
const newTitle = workMeetings[0].title;
92+
const issueUrl = workMeetings[0].html_url;
7793
const issueDate = newTitle.replace(/Open Community Working Meeting /g, "");
7894
95+
console.log("Found issue number:", issueNumber);
96+
console.log("Issue title:", newTitle);
97+
console.log("Issue URL:", issueUrl);
98+
console.log("Extracted date from title:", issueDate);
99+
79100
// Notify Slack
80101
const SLACK_WEBHOOK_URL = process.env.SLACK_WEBHOOK;
81102
const SLACK_MESSAGE = `{
82103
"issue": "https://github.com/${process.env.OWNER}/${process.env.REPO}/issues/${issueNumber}",
83104
"date": "${issueDate}"
84105
}`;
85106
86-
await fetch(SLACK_WEBHOOK_URL, {
107+
console.log("Slack message payload:", SLACK_MESSAGE;
108+
109+
console.log("Sending Slack reminder notification...");
110+
const slackResponse = await fetch(SLACK_WEBHOOK_URL, {
87111
method: 'POST',
88112
headers: {
89113
'Content-Type': 'application/json',
90114
},
91115
body: SLACK_MESSAGE,
92116
});
117+
118+
console.log("Slack response status:", slackResponse.status);
119+
console.log("Slack response status text:", slackResponse.statusText);
120+
121+
if (!slackResponse.ok) {
122+
const errorText = await slackResponse.text();
123+
console.error("Slack reminder notification failed:", errorText);
124+
throw new Error(`Slack reminder notification failed: ${slackResponse.status} ${slackResponse.statusText}`);
125+
} else {
126+
const responseText = await slackResponse.text();
127+
console.log("Slack reminder notification sent successfully");
128+
console.log("Slack response:", responseText);
129+
}

0 commit comments

Comments
 (0)