build(deps): bump actions/create-github-app-token from 1.11.2 to 1.11.3 #89
This file contains hidden or 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
| 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.2.2 | |
| - 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="chore(license-year): bump from $OLD_YEAR to $NEW_YEAR" | |
| UPDATE_BODY="Bump LICENSE year from $OLD_YEAR to $NEW_YEAR." | |
| 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$LICENSE_YEAR\2/" LICENSE | |
| env: | |
| LICENSE_YEAR: ${{steps.info.outputs.license-year}} | |
| - name: Generate app token | |
| id: app-token | |
| uses: actions/create-github-app-token@v1.11.3 | |
| with: | |
| app-id: ${{secrets.GH_APP_ID}} | |
| private-key: ${{secrets.GH_APP_PRIVATE_KEY}} | |
| - name: Generate user info | |
| id: user-info | |
| run: | | |
| USER_NAME="$GH_APP_SLUG[bot]" | |
| USER_ID=$(gh api "/users/$USER_NAME" --jq .id) | |
| USER_EMAIL="$USER_ID+$USER_NAME@users.noreply.github.com" | |
| echo "id=$USER_ID" >> $GITHUB_OUTPUT | |
| echo "name=$USER_NAME" >> $GITHUB_OUTPUT | |
| echo "email=$USER_ID+$USER_NAME@users.noreply.github.com" >> $GITHUB_OUTPUT | |
| echo "commit-author=$USER_NAME <$USER_EMAIL>" >> $GITHUB_OUTPUT | |
| env: | |
| GH_APP_SLUG: ${{steps.app-token.outputs.app-slug}} | |
| GH_TOKEN: ${{steps.app-token.outputs.token}} | |
| - name: Handle changes | |
| uses: peter-evans/create-pull-request@v7.0.6 | |
| id: changes | |
| with: | |
| token: ${{steps.app-token.outputs.token}} | |
| commit-message: ${{steps.info.outputs.update-title}} | |
| author: ${{steps.user-info.outputs.commit-author}} | |
| committer: ${{steps.user-info.outputs.commit-author}} | |
| add-paths: LICENSE | |
| branch: auto/update-license | |
| delete-branch: true | |
| title: ${{steps.info.outputs.update-title}} | |
| body: ${{steps.info.outputs.update-body}} | |
| labels: auto | |
| - name: Enable auto-merge | |
| if: steps.changes.outputs.pull-request-operation == 'created' | |
| run: gh pr merge --auto --rebase "$PULL_REQUEST_URL" | |
| env: | |
| PULL_REQUEST_URL: ${{steps.changes.outputs.pull-request-url}} | |
| GITHUB_TOKEN: ${{steps.app-token.outputs.token}} |