alphagov / alphagov/govuk-developer-docs

Conditional logic for deployment commit messages isn't working

Open
#3,322 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
143
Forks
39
Avg merge
1d 4h
Merged PRs (30d)
12

Description

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:

https://github.com/alphagov/govuk-developer-docs/blob/b0c0a6d958b82af36184794e5e9eaf5559262252/.github/workflows/ci.yml#L31-L38

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in .github/workflows/ci.yml around lines 31-38, then check the GitHub Actions event context for schedule and push triggers. Test the workflow's conditional logic for both trigger types and confirm that deployed commit messages use the event-specific message instead of always using "Hourly scheduled redeploy".

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.