Scheduled workflow can't access secrets

I recently added an on: schedule: trigger to a workflow that has been working fine via its on:push: trigger for some time. The workflow sends notifications to a couple of Slack channels via webhook URL stored in secrets. The schedule-triggered action fails to notify the Slack channels with the message ##[error]Cannot read property 'url' of undefined.

Here is an example of the failure:

This looks to me like the scheduled workflow is being blocked from accessing secrets, but I can’t find anything in the docs that tells me that should be the case. I’m seeing this in several repos, some of which use organization secrets, others that use repo secrets.

Is this a known issue that I am failing to find in my searching, or am I doing something wrong?

@douglatornell Scheduled workflows do receive secrets. Looking at your example, you can also see the masked secrets (the ***), so some value was passed to the action.

The problem is with the action you’re calling, looking at the code it tries to read head_commit from the JSON payload. That doesn’t exist for scheduled workflows and leads to this error:

1 Like

Thanks @cschleiden ! I had looked at the action code but didn’t connect the dots about it trying to read a non-existent head_commit. I’ll see if I can engage with the action author to collaborate on a we of resolving this.

1 Like

For anyone who find this thread in the future: I couldn’t find an obvious good way to enable pioug/le-slack-message@v1.0.0 to work for schedule events, so I changed to use 8398a7/action-slack@v3 for Slack notifications.