Skip to content

update-depend-versions #516

update-depend-versions

update-depend-versions #516

name: update-depend-versions
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
update-depend-versions:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Check out repository
uses: actions/checkout@v3
- name: Set up sd
uses: kenji-miyake/setup-sd@v1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Get flake8 versions
id: get-flake8-versions
run: |
function get-latest-pip-version() {
pip index versions "$1" 2>/dev/null | head -n1 | sd '.*\((.*)\)' '$1'
}
echo ::set-output name=flake8-version::$(get-latest-pip-version flake8)
echo ::set-output name=flake8-blind-except-version::$(get-latest-pip-version flake8-blind-except)
echo ::set-output name=flake8-builtins-version::$(get-latest-pip-version flake8-builtins)
echo ::set-output name=flake8-class-newline-version::$(get-latest-pip-version flake8-class-newline)
echo ::set-output name=flake8-comprehensions-version::$(get-latest-pip-version flake8-comprehensions)
echo ::set-output name=flake8-deprecated-version::$(get-latest-pip-version flake8-deprecated)
echo ::set-output name=flake8-docstrings-version::$(get-latest-pip-version flake8-docstrings)
echo ::set-output name=flake8-import-order-version::$(get-latest-pip-version flake8-import-order)
echo ::set-output name=flake8-quotes-version::$(get-latest-pip-version flake8-quotes)
- name: Update flake8 version
run: |
sd '(flake8)==\d+\.\d+(\.\d+)?' '$1==${{ steps.get-flake8-versions.outputs.flake8-version }}' .pre-commit-hooks.yaml
sd '(flake8-blind-except)==\d+\.\d+(\.\d+)?' '$1==${{ steps.get-flake8-versions.outputs.flake8-blind-except-version }}' .pre-commit-hooks.yaml
sd '(flake8-builtins)==\d+\.\d+(\.\d+)?' '$1==${{ steps.get-flake8-versions.outputs.flake8-builtins-version }}' .pre-commit-hooks.yaml
sd '(flake8-class-newline)==\d+\.\d+(\.\d+)?' '$1==${{ steps.get-flake8-versions.outputs.flake8-class-newline-version }}' .pre-commit-hooks.yaml
sd '(flake8-comprehensions)==\d+\.\d+(\.\d+)?' '$1==${{ steps.get-flake8-versions.outputs.flake8-comprehensions-version }}' .pre-commit-hooks.yaml
sd '(flake8-deprecated)==\d+\.\d+(\.\d+)?' '$1==${{ steps.get-flake8-versions.outputs.flake8-deprecated-version }}' .pre-commit-hooks.yaml
sd '(flake8-docstrings)==\d+\.\d+(\.\d+)?' '$1==${{ steps.get-flake8-versions.outputs.flake8-docstrings-version }}' .pre-commit-hooks.yaml
sd '(flake8-import-order)==\d+\.\d+(\.\d+)?' '$1==${{ steps.get-flake8-versions.outputs.flake8-import-order-version }}' .pre-commit-hooks.yaml
sd '(flake8-quotes)==\d+\.\d+(\.\d+)?' '$1==${{ steps.get-flake8-versions.outputs.flake8-quotes-version }}' .pre-commit-hooks.yaml
- name: Get prettier versions
id: get-prettier-versions
run: |
function get-latest-npm-version() {
npm show "$1" version
}
echo ::set-output name=prettier-version::$(get-latest-npm-version prettier)
echo ::set-output name=prettier-xml-version::$(get-latest-npm-version @prettier/plugin-xml)
- name: Update prettier version
run: |
sd '(prettier)@\d+\.\d+\.\d+' '$1@${{ steps.get-prettier-versions.outputs.prettier-version }}' .pre-commit-hooks.yaml
sd '(@prettier/plugin-xml)@\d+\.\d+\.\d+' '$1@${{ steps.get-prettier-versions.outputs.prettier-xml-version }}' .pre-commit-hooks.yaml
- name: Create PR
id: create-pr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ steps.generate-token.outputs.token }}
base: ${{ github.event.repository.default_branch }}
branch: update-depend-versions
title: "chore: update depend versions"
commit-message: "chore: update depend versions"
body: ""
labels: |
bot
update-depend-versions
signoff: true
delete-branch: true
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}"
shell: bash
- name: Enable auto-merge
if: ${{ steps.create-pr.outputs.pull-request-operation == 'created' }}
run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}"
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}