diff --git a/.github/workflows/update-license.yml b/.github/workflows/update-license.yml new file mode 100644 index 0000000..a27890b --- /dev/null +++ b/.github/workflows/update-license.yml @@ -0,0 +1,45 @@ +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: 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-2024/2014-$(date +'%Y')/" $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 diff --git a/{{cookiecutter.repository_name}}/licenses/sonarsource.txt b/{{cookiecutter.repository_name}}/licenses/sonarsource.txt index 616cadf..3e433a4 100644 --- a/{{cookiecutter.repository_name}}/licenses/sonarsource.txt +++ b/{{cookiecutter.repository_name}}/licenses/sonarsource.txt @@ -1,3 +1,3 @@ -Copyright (C) SonarSource SA +Copyright (C) 2014-2023 SonarSource SA All rights reserved mailto:info AT sonarsource DOT com