Skip to content

Commit ff7ad41

Browse files
committed
Merge branch 'ci/improve_github_workflows' into 'master'
ci: improve github workflows and adapt Espressif commitizen plugin See merge request espressif/esp-serial-flasher!138
2 parents 86fd459 + d31cefc commit ff7ad41

File tree

5 files changed

+215
-102
lines changed

5 files changed

+215
-102
lines changed

.cz.toml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
11
[tool.commitizen]
2+
name = "czespressif"
23
version = "1.7.0"
34
update_changelog_on_bump = true
4-
version_scheme = "semver"
55
tag_format = "v$version"
66
changelog_merge_prerelease = true
77
annotated_tag = true
8+
changelog_start_rev = "v1.0.0"
89
bump_message = "change: Update version to $new_version"
910
version_files = [
1011
"idf_component.yml:version"
1112
]
12-
change_type_order = [
13-
"BREAKING CHANGE",
14-
"New Features",
15-
"Bug Fixes",
16-
"Code Refactoring",
17-
"Performance Improvements"
18-
]
19-
20-
[tool.commitizen.change_type_map]
21-
feat = "New Features"
22-
fix = "Bug Fixes"
23-
refactor = "Code Refactoring"
24-
perf = "Performance Improvements"

.github/workflows/dangerjs.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: DangerJS Check
2+
on:
3+
pull_request_target:
4+
types: [opened, edited, reopened, synchronize]
5+
6+
permissions:
7+
pull-requests: write
8+
contents: write
9+
10+
jobs:
11+
pull-request-style-linter:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out PR head
15+
uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.event.pull_request.head.sha }}
18+
19+
- name: DangerJS pull request linter
20+
uses: espressif/github-actions/danger_pr_review@master
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/new_release.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@ name: Create a new release from a tag
33
on:
44
push:
55
tags:
6-
- "v*.*.*"
7-
8-
permissions:
9-
contents: write
6+
- v*
107

118
jobs:
12-
build:
9+
create_release:
10+
name: Create GitHub release
1311
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
1414
steps:
1515
- name: Get version
1616
id: get_version
1717
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
18+
shell: bash
1819
- name: Checkout
19-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2021
with:
2122
fetch-depth: 0
22-
- name: Get Python packages
23-
run: pip install Commitizen
23+
- name: Install dependencies
24+
run: pip install commitizen czespressif>=1.3.1
2425
- name: Generate changelog
2526
run: |
2627
cz changelog ${{ steps.get_version.outputs.VERSION }} --file-name changelog_body.md
@@ -33,3 +34,4 @@ jobs:
3334
body_path: changelog_body.md
3435
name: Version ${{ steps.get_version.outputs.VERSION }}
3536
draft: true
37+
prerelease: false

.github/workflows/pre_commit.yml

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,40 @@
1-
name: Pre-commit checks
1+
name: Check pre-commit rules
22

3-
on: pull_request
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
permissions:
8+
contents: read
49

510
jobs:
6-
pre_commit:
11+
pre_commit_check:
712
runs-on: ubuntu-latest
813
steps:
914
- name: Checkout
10-
uses: actions/checkout@v3
11-
with:
12-
fetch-depth: 0
13-
14-
- name: Set up Python 3.11
15-
uses: actions/setup-python@v5
15+
uses: actions/checkout@v4
16+
- name: Fetch head and base refs
17+
# This is necessary for pre-commit to check the changes in the PR branch
18+
run: |
19+
git fetch origin ${{ github.base_ref }}:base_ref
20+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_ref
21+
- name: Set up Python environment
22+
uses: actions/setup-python@master
1623
with:
17-
python-version: '3.11'
18-
19-
- name: Set up pre-commit
20-
run: pip install pre-commit
21-
22-
- name: Run pre-commit
23-
run: pre-commit run --show-diff-on-failure --from-ref origin/master --to-ref HEAD
24+
python-version: v3.11
25+
- name: Install python packages
26+
run: |
27+
pip install pre-commit
28+
pre-commit install-hooks
29+
- name: Run pre-commit and check for any changes
30+
run: |
31+
echo "Commits being checked:"
32+
git log --oneline --no-decorate base_ref..pr_ref
33+
echo ""
34+
if ! pre-commit run --from-ref base_ref --to-ref pr_ref --show-diff-on-failure ; then
35+
echo ""
36+
echo "::notice::It looks like the commits in this PR have been made without having pre-commit hooks installed."
37+
echo "::notice::Please see https://github.com/espressif/esp-serial-flasher?tab=readme-ov-file#contributing for instructions."
38+
echo ""
39+
exit 1
40+
fi

0 commit comments

Comments
 (0)