Skip to content

Commit e286503

Browse files
authored
devops(workflow): create copyright.yml
Workflow to update license copyright year annually.
1 parent ef424c6 commit e286503

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/copyright.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: Copyright
3+
run-name: Copyright
4+
description: Updates license copyright year annually.
5+
permissions: {}
6+
7+
on:
8+
schedule:
9+
- cron: 0 0 1 1 *
10+
11+
workflow_dispatch:
12+
13+
jobs:
14+
license-copyright:
15+
name: Update license copyright year
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
22+
steps:
23+
- name: Create GitHub app token
24+
id: github-app-token
25+
uses: actions/create-github-app-token@v2
26+
with:
27+
app-id: ${{ secrets.CONTINUOUS_INTEGRATION_BOT_ID }}
28+
private-key: ${{ secrets.CONTINUOUS_INTEGRATION_BOT_KEY }}
29+
permission-contents: write
30+
permission-pull-requests: write
31+
32+
- name: Checkout license file
33+
uses: actions/checkout@v5
34+
with:
35+
token: ${{ steps.github-app-token.outputs.token }}
36+
sparse-checkout: LICENSE
37+
persist-credentials: true
38+
sparse-checkout-cone-mode: false
39+
40+
- name: Create pull request to update license copyright year
41+
id: update-license
42+
uses: FantasticFiasco/action-update-license-year@d837fc83ecb71196807bdf3854208f556e66f6ed
43+
with:
44+
token: ${{ steps.github-app-token.outputs.token }}
45+
labels: bot
46+
prTitle: Update license copyright year to {{currentYear}}
47+
branchName: github-action/update-license-year-to-{{currentYear}}
48+
commitTitle: "docs: update license copyright year"
49+
commitAuthorName: github-actions[bot]
50+
commitAuthorEmail: github-actions[bot]@users.noreply.github.com
51+
52+
- name: Merge pull request
53+
if: ${{ steps.update-license.outputs.pullRequestNumber != '' }}
54+
run: gh pr merge $PULL_REQUEST_NUMBER --admin --merge --delete-branch
55+
env:
56+
GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }}
57+
PULL_REQUEST_NUMBER: ${{ steps.update-license.outputs.pullRequestNumber }}
58+
59+
concurrency:
60+
group: copyright
61+
cancel-in-progress: true

0 commit comments

Comments
 (0)