Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional logic for deployment commit messages isn't working #3322

Open
ollietreend opened this issue Nov 30, 2021 · 0 comments
Open

Conditional logic for deployment commit messages isn't working #3322

ollietreend opened this issue Nov 30, 2021 · 0 comments

Comments

@ollietreend
Copy link
Contributor

When GitHub Actions deploys to GitHub Pages, it uses conditional logic to decide which commit message to use. According to the config file, it looks like the commit message should be determined by the event that triggered the build:

- name: Set commit message up front
id: commit_message_writer
run: | # `github.event.number` will be blank if this is a cron
if [ "${{ github.event.number }}" == "" ]; then
echo "::set-output name=commit_message::Hourly scheduled redeploy"
else
echo "::set-output name=commit_message::Deploy via merge"
fi

However in practice, the commit message is always "Hourly scheduled redeploy".

It looks like ${{ github.event.number }} always evaluates to an empty string. This seems consistent with the GitHub docs for builds triggered by a 'push' event, which suggests that number isn't a property of 'push' events.

Instead, I think we could probably change the if statement to something like this:

- if [ "${{ github.event.number }}" == "" ]; then
+ if [ "${{ github.event_name }}" == "schedule" ]; then

It assumes that cron-triggered builds have an event_name of "schedule" – which I think is correct, but this assumption would need to be tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant