Skip to content

Bump peter-evans/create-pull-request from 6.0.1 to 6.0.2 (#88) #50

Bump peter-evans/create-pull-request from 6.0.1 to 6.0.2 (#88)

Bump peter-evans/create-pull-request from 6.0.1 to 6.0.2 (#88) #50

name: Update License
on:
push:
branches: main
paths: .github/workflows/update-license.yml
schedule:
- cron: '0 0 1 1 *'
workflow_dispatch:
permissions:
contents: read
concurrency: update-license
jobs:
update-license:
name: Update License
runs-on: ubuntu-latest
timeout-minutes: 5
env:
REGEX: ^(Copyright \(c\) )[0-9]{4}( Devon Powell)$
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Determine info
shell: bash
id: info
run: |
OLD_YEAR=$(grep -oEi "$REGEX" LICENSE | grep -oEi '[0-9]{4}')
NEW_YEAR=$(date +%Y)
UPDATE_TITLE="Bump LICENSE year from $OLD_YEAR to $NEW_YEAR"
UPDATE_BODY="$UPDATE_TITLE."
echo "license-year=$NEW_YEAR" >> $GITHUB_OUTPUT
echo "update-title=$UPDATE_TITLE" >> $GITHUB_OUTPUT
echo "update-body=$UPDATE_BODY" >> $GITHUB_OUTPUT
- name: Update LICENSE
run: |
sed -i -E "s/$REGEX/\1${{steps.info.outputs.license-year}}\2/" LICENSE
- name: Handle changes
uses: peter-evans/create-pull-request@v6.0.2
id: changes
with:
token: ${{secrets.AUTOMATION_TOKEN}}
commit-message: ${{steps.info.outputs.update-title}}
committer: ${{env.GIT_USER}}
add-paths: LICENSE
author: ${{env.GIT_USER}}
branch: auto/update-license
delete-branch: true
title: ${{steps.info.outputs.update-title}}
body: ${{steps.info.outputs.update-body}}
labels: auto
env:
GIT_USER: ${{secrets.AUTOMATION_USER}} <${{secrets.AUTOMATION_EMAIL}}>
- name: Enable auto-merge
if: steps.changes.outputs.pull-request-operation == 'created'
run: gh pr merge --auto --squash "$PULL_REQUEST_URL"
env:
PULL_REQUEST_URL: ${{steps.changes.outputs.pull-request-url}}
GITHUB_TOKEN: ${{secrets.AUTOMATION_TOKEN}}