name: Copyright Check on: push: jobs: check-copyright: runs-on: ubuntu-latest steps: - name: Fetch current year run: | YEAR=$(date +%Y) echo "Current year is $YEAR" - name: Update LICENSE file run: | echo "Copyright (c) 2017-${YEAR}, Evan Pratten, All rights reserved." > /tmp/correct_license - name: Check if LICENSE file has changed id: license-check run: | ls /home/runner/work/ewpratten.com ls /home/runner/work/ewpratten.com/ewpratten.com diff /tmp/correct_license ${GITHUB_WORKSPACE}/LICENSE - name: Display a commit comment if the year is wrong if: steps.license-check.outcome == 'failure' uses: peter-evans/commit-comment@v2 with: body: | The year in your LICENSE file is out of date. Please update the file to: ``` $(cat /tmp/correct_license) ```