-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.79 KB
/
main.yml
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
name: main
on:
push:
branches: [main]
schedule:
- cron: '15 8 * * *'
jobs:
build:
name: main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- run: pip install pre-commit-mirror-maker
- run: git config --global user.name 'Github Actions'
- run: git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
- run: >
pre-commit-mirror .
--id=commitlint
--package-name=commitlint
--description "runs commitlint on the message of the commit being made"
--entry='commitlint --edit'
--language=node
--types=text
# pre-commit-mirror-maker has no support for multiple/additional hooks. Add
# additional hooks manually.
- run: |
# If no version was released, then there is nothing to change
if [[ ! "$(git status -sb)" =~ "ahead" ]]; then exit 0; fi
latest_tag="$(git describe --tags --abbrev=0)"
# Add additional hooks
cat <<END >> .pre-commit-hooks.yaml
- id: commitlint-all
name: commitlint-all
description: 'runs commitlint in CI on all commit messages'
entry: commitlint --from --
language: node
'types': [text]
args: []
require_serial: false
additional_dependencies: ["commitlint@${latest_tag:1}"]
minimum_pre_commit_version: '0'
END
# Amend both the commit and tag with the additions
git commit --amend -a --no-edit
git tag -f $latest_tag
- run: |
git remote set-url origin https://x-access-token:[email protected]/$GITHUB_REPOSITORY
git push origin HEAD:refs/heads/main --tags
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}