Skip to content

Update License Years #5

Update License Years

Update License Years #5

---
# Update the year in license files
name: Update License Years
permissions: {}
on:
schedule:
- cron: '0 2 1 1 *' # run on 1st Jan every year at 2am UTC
workflow_dispatch:
jobs:
setup-matrix:
name: Setup Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.result }}
steps:
# get all repos in this org
- name: Get repos
id: set-matrix
uses: actions/github-script@v8
with:
script: |
const opts = github.rest.repos.listForOrg.endpoint.merge({ org: context.repo.owner });
const repos = await github.paginate(opts)
// create a GitHub strategy matrix
let matrix = { "include": [] };
for (const repo of repos) {
matrix.include.push({ "repo": repo.name });
}
return matrix
update:
name: Update License Year (${{ matrix.repo }})
needs: setup-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
max-parallel: 1 # run one at a time to attempt to avoid GitHub api rate limits
steps:
- name: Checkout
uses: actions/checkout@v6
with:
repository: ${{ github.repository_owner }}/${{ matrix.repo }}
fetch-depth: 0
persist-credentials: false
- name: Update license year
uses: FantasticFiasco/action-update-license-year@f180e962fa988db222d8f03ef4636750312d1b3d # v3.0.4
with:
commitAuthorEmail: ${{ secrets.GH_BOT_EMAIL }}
commitAuthorName: ${{ secrets.GH_BOT_NAME }}
commitTitle: 'docs(license): update copyright year(s) to {{currentYear}}'
prTitle: 'docs(license): update copyright year(s) to {{currentYear}}'
token: ${{ secrets.GH_BOT_TOKEN }}