Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

The copyright update workflow failed because $(date +%Y) shell substitution in YAML parameters was treated as a literal string, creating an invalid branch name copyright-year-update-$(date +%Y).

Changes

  • Added step to set YEAR environment variable using $GITHUB_OUTPUT
  • Replaced all $(date +%Y) references with ${{ steps.date.outputs.year }} in:
    • Branch name
    • Commit message
    • PR title and body
  • Updated workflow to use GitHub App token for PR creation via peter-evans/create-pull-request action
  • Changed workflow runner to ubuntu-24.04-16cores-public for improved performance

Shell commands only execute within run: blocks; workflow parameters require GitHub Actions expressions.

Remember to include the following changes:

  • Component README.md (N/A - workflow-only change)
  • Tests (N/A - workflow-only change)

If you are curious about how we review, please read through the code review guidelines

Original prompt

This section details on the original issue you should resolve

<issue_title>[DON-Nojira] Fix Action CopyRight Update Failure</issue_title>
<issue_description></issue_description>

<agent_instructions>I am facing this failure here https://github.com/Skyscanner/backpack-android/actions/runs/20629651074/job/59457732892 and The job failed because the branch name and pull request branch in the workflow (.github/workflows/update-copyright.yml, ref b4d6059) were set using the literal string
(
d
a
t
e
(date +%Y)' is not a valid branch name.

To fix this, use GitHub Actions' built-in date substitution or environment variables rather than shell command substitution in the workflow definition. Here's how you can update the branch name and other references:

Replace:

YAML
branch: copyright-year-update-$(date +%Y)
commit-message: "chore: update copyright year to $(date +%Y)"
title: "chore: update copyright year to $(date +%Y)"
body: |
This PR updates the copyright year in all source files from 2018 to $(date +%Y).
With:

YAML
branch: copyright-year-update-${{ github.event.schedule && format('YYYY', fromJson('"' + github.event.scheduled_at + '"')) || format('YYYY', github.run_started_at) }}
commit-message: "chore: update copyright year to ${{ format('YYYY', github.run_started_at) }}"
title: "chore: update copyright year to ${{ format('YYYY', github.run_started_at) }}"
body: |
This PR updates the copyright year in all source files from 2018 to ${{ format('YYYY', github.run_started_at) }}.
Or, for most cases, you can simply use the current year as an environment variable at the start of your job:

YAML
env:
YEAR: ${{ github.run_started_at && format('YYYY', github.run_started_at) || '2026' }}
And then reference ${{ env.YEAR }} in your workflow fields accordingly:

YAML
branch: copyright-year-update-${{ env.YEAR }}
commit-message: "chore: update copyright year to ${{ env.YEAR }}"
title: "chore: update copyright year to ${{ env.YEAR }}"
body: |
This PR updates the copyright year in all source files from 2018 to ${{ env.YEAR }}.
This ensures variable substitution is handled correctly by GitHub Actions and your workflow will not fail with an invalid branch name. can you fix it</agent_instructions>

Comments on the Issue (you are Copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ables instead of shell substitution

Co-authored-by: peterInTown <[email protected]>
Copilot AI changed the title [WIP] Fix Action copyright update failure in workflow fix: replace shell command substitution with GitHub Actions env variables in copyright workflow Jan 5, 2026
@skyscanner-backpack-bot skyscanner-backpack-bot bot added the ai: copilot used to indicate involvement of copilot in writing code in this PR label Jan 5, 2026
@peterInTown peterliu (peterInTown) added the minor A new & backwards compatible feature/component label Jan 5, 2026
@peterInTown peterliu (peterInTown) marked this pull request as ready for review January 5, 2026 14:05
Copilot AI review requested due to automatic review settings January 5, 2026 14:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the copyright update workflow by replacing shell command substitution with GitHub Actions environment variables. The workflow was failing because $(date +%Y) was being interpreted as a literal string in YAML parameters instead of being executed, resulting in an invalid branch name.

Key changes:

  • Added a step to set the YEAR environment variable using $GITHUB_ENV
  • Replaced all $(date +%Y) shell substitutions with GitHub Actions expression ${{ env.YEAR }}

@henrik-sky
Copy link
Contributor

Copilot change the runner to runs-on: ubuntu-24.04-16cores-public

Copy link
Contributor Author

Copilot AI commented Jan 6, 2026

Copilot change the runner to runs-on: ubuntu-24.04-16cores-public

Changed in 913cb0f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai: copilot used to indicate involvement of copilot in writing code in this PR minor A new & backwards compatible feature/component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DON-Nojira] Fix Action CopyRight Update Failure

5 participants