-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUILD-6701 Update license and add automated way of updating
- Loading branch information
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Update SonarSource License | ||
|
||
on: | ||
push: | ||
schedule: | ||
# - cron: '0 0 1 1 *' # At 00:00 on January 1st every year | ||
- cron: '*/5 * * * *' # Every 5 minutes for testing purposes | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
update-license: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Get current date | ||
id: date | ||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | ||
|
||
- name: Print current year | ||
run: | | ||
echo "Current Year: $(date +'%Y')" | ||
- name: Checkout repository | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Update license year | ||
run: | | ||
ls -l | ||
pwd | ||
FILE_PATH="{{cookiecutter.repository_name}}/licenses/sonarsource.txt" | ||
cat $FILE_PATH | ||
sed -i "s/2014-[0-9]\{4\}/2014-$(date +'%Y')/" $FILE_PATH | ||
cat $FILE_PATH | ||
- name: Commit changes | ||
run: | | ||
git config --global user.name 'sonartech' | ||
git config --global user.email 'sonartech@sonarsource.com' | ||
git checkout -b feat/bot/update-license-year | ||
git add . | ||
git commit -m "Update SonarSource license year to $(date +'%Y')" | ||
git push --set-upstream origin feat/bot/update-license-year | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.5.0 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: feat/bot/update-license-year | ||
title: "Update SonarSource license year to $(date +'%Y')" | ||
body: "This PR updates the SonarSource license year to $(date +'%Y')." | ||
base: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Copyright (C) SonarSource SA | ||
Copyright (C) 2014-2023 SonarSource SA | ||
All rights reserved | ||
mailto:info AT sonarsource DOT com |