File: pre-commit-detect-outdated.yml

package info (click to toggle)
git-big-picture 1.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,284 kB
  • sloc: python: 1,130; sh: 89; makefile: 17
file content (76 lines) | stat: -rw-r--r-- 2,834 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# This file is part of git-big-picture
#
# Copyright (c) 2020-2022 Sebastian Pipping <sebastian@pipping.org>
#
# git-big-picture is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# git-big-picture is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with git-big-picture.  If not, see <http://www.gnu.org/licenses/>.

name: Detect outdated pre-commit hooks

on:
  schedule:
    - cron: '0 16 * * 5'  # Every Friday 4pm

# NOTE: This will drop all permissions from GITHUB_TOKEN except metadata read,
#       and then (re)add the ones listed below:
permissions:
  contents: write
  pull-requests: write

jobs:
  pre_commit_detect_outdated:
    name: Detect outdated pre-commit hooks
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11  # v4.1.1

      - name: Set up Python 3.12
        uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c  # v5.0.0
        with:
          python-version: 3.12

      - name: Install pre-commit
        run: |-
          pip install \
            --disable-pip-version-check \
            --no-warn-script-location \
            --user \
            pre-commit
          echo "PATH=${HOME}/.local/bin:${PATH}" >> "${GITHUB_ENV}"

      - name: Check for outdated hooks
        run: |-
          pre-commit autoupdate
          git diff -- .pre-commit-config.yaml

      - name: Create pull request from changes (if any)
        id: create-pull-request
        uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc  # v6.0.1
        with:
          author: 'pre-commit <pre-commit@tools.invalid>'
          base: main
          body: |-
            For your consideration.

            :warning: Please **CLOSE AND RE-OPEN** this pull request so that [further workflow runs get triggered](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs) for this pull request.
          branch: precommit-autoupdate
          commit-message: "pre-commit: Autoupdate"
          delete-branch: true
          draft: true
          labels: enhancement
          title: "pre-commit: Autoupdate"

      - name: Log pull request URL
        if: "${{ steps.create-pull-request.outputs.pull-request-url }}"
        run: |
          echo "Pull request URL is: ${{ steps.create-pull-request.outputs.pull-request-url }}"