freeCodeCamp / classroom

BSD 3-Clause "New" or "Revised" License
143 stars 121 forks source link

Automate the updating of copyright years from 2021 to 2024/2025/etc. in LICENSE.md and README.md #381

Closed lloydchang closed 1 year ago

lloydchang commented 1 year ago

Describe the issue Automate the updating of copyright years from 2021 to 2024/2025/etc. in LICENSE.md and README.md

To Reproduce Steps to reproduce the behavior:

  1. Go to https://github.com/lloydchang/freeCodeCamp-classroom/blob/copyright-years/README.md
  2. Scroll to the bottom
  3. It says Copyright © 2021 freeCodeCamp.org

Expected behavior It should change next year to Copyright © 2024 freeCodeCamp.org followed by another change in the subsequent year to Copyright © 2025 freeCodeCamp.org

Instead of doing this manually, can this be automated?

For example, add a new file:

https://github.com/lloydchang/freeCodeCamp-classroom/new/copyright-years/.github/workflows/update-license.yaml

name: Update copyright year(s) in license file

on:
  schedule:
    - cron: '0 0 1 1 *' # Midnight on January 1st

jobs:
  update-license-year:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - uses: FantasticFiasco/action-update-license-year@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          path: |
            LICENSE
            README.md
          commitTitle: 'docs: update copyright years'
          prTitle: 'docs: update copyright years'
          prBody: It's that time of the year. Let's update LICENSE and README.md
          labels: 'status: waiting review'

Additional context

This is similar to feat(workflow): create update license yearly action #49115 https://github.com/freeCodeCamp/freeCodeCamp/pull/49115

https://github.com/FantasticFiasco/action-update-license-year is a GitHub Action that updates the copyright year.

This is an automated technique similar to

https://github.com/FantasticFiasco/action-update-license-year#super-simple-to-use

name: Update copyright year(s) in license file

on:
  schedule:
    - cron: '0 3 1 1 *' # 03:00 AM on January 1

jobs:
  update-license-year:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - uses: FantasticFiasco/action-update-license-year@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

and

https://github.com/freeCodeCamp/freeCodeCamp/blob/main/.github/workflows/update-license.yaml

name: Update copyright year(s) in license file

on:
  workflow_dispatch:
  schedule:
    - cron: '0 3 1 1 *'

jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
        with:
          fetch-depth: 0
      - uses: FantasticFiasco/action-update-license-year@26ffac173f956c25f7467aa8e6f750eed24a1b7a # v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          path: |
            README.md
            LICENSE
          commitTitle: 'docs: update copyright years'
          prTitle: 'docs: update copyright years'
          prBody: It's that time of the year, let's update the license
          labels: 'status: waiting review'
Komal914 commented 1 year ago

Hey, could I take over this issue? @lloydchang Please assign me.

lloydchang commented 1 year ago

@Komal914 Sorry that GitHub wasn't clear.

In this issue, it says:

lloydchang linked a pull request 5 days ago that will close this issue ci(update-license.yaml): add automation to change copyright years #382

because I had implemented it via https://github.com/freeCodeCamp/classroom/pull/382

Ask: Would you like to read the pull request https://github.com/freeCodeCamp/classroom/pull/382 and ask me questions, if you have any, about it?

Thanks!

Screen Shot 2023-07-27 at 6 08 37 PM