Skip to content

Commit 0a1e7ec

Browse files
committed
ci: Add GHA for refreshing authors of files
1 parent b71db83 commit 0a1e7ec

File tree

2 files changed

+76
-4
lines changed

2 files changed

+76
-4
lines changed

.github/workflows/refresh-authors.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
name: Authors (C) updater
3+
4+
on:
5+
# Compare the preceeding commit of master -> to the current commit of the master branch.
6+
# (Note: To compare changes between the last pushed commit to the remote master branch set `since_last_remote_commit: true`)
7+
push:
8+
branches:
9+
- master
10+
# Compare the last commit of master -> to the current commit of a PR branch.
11+
# (Note: To compare changes between the last pushed commit to the remote PR branch set `since_last_remote_commit: true`)
12+
pull_request:
13+
branches:
14+
- master
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest # windows-latest | macos-latest
19+
name: Test changed-files
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
24+
25+
- name: Get changed files in the checks folder
26+
id: changed-files-specific
27+
uses: tj-actions/changed-files@v34
28+
with:
29+
files: |
30+
**/*.py
31+
**/*.yml
32+
**/*.sh
33+
**/*.txt
34+
35+
- name: Run step if any file(s) in the watched folder change
36+
if: steps.changed-files-specific.outputs.any_changed == 'true'
37+
run: |
38+
echo "One or more files in the scripts folder has changed, updating the files"
39+
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
40+
41+
# Update authors from mailmap to avoid errors
42+
python setup.py sdist
43+
44+
# Run the script that updates all the headers with the new ones
45+
python refresh-contributors.py
46+
47+
- name: Commit back the updated files to the repository
48+
if: steps.changed-files-specific.outputs.any_changed == 'true'
49+
uses: stefanzweifel/git-auto-commit-action@v4
50+
with:
51+
# Optional. Commit message for the created commit.
52+
# Defaults to "Apply automatic changes"
53+
commit_message: "[skip ci] Autoupdate (C) on script change"
54+
55+
# Optional. Local and remote branch name where commit is going to be pushed
56+
# to. Defaults to the current branch.
57+
# You might need to set `create_branch: true` if the branch does not exist.
58+
branch: master
59+
60+
# Optional. Options used by `git-commit`.
61+
# See https://git-scm.com/docs/git-commit#_options
62+
commit_options: '--no-verify --signoff'
63+
64+
# Optional. Local file path to the repository.
65+
# Defaults to the root of the repository.
66+
repository: .
67+
68+
# Optional glob pattern of files which should be added to the commit
69+
# Defaults to all (.)
70+
# See the `pathspec`-documentation for git
71+
# - https://git-scm.com/docs/git-add#Documentation/git-add.txt-ltpathspecgt82308203
72+
# - https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec
73+
file_pattern: '**/*.py **/*.yml **/*.sh **/*.txt'

.mailmap

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
22
3-
43
4+
55
66
77
@@ -19,11 +19,10 @@ Masaki Furuta <[email protected]> <[email protected]>
1919
Mikel Olasagasti Uranga <[email protected]> <[email protected]>
2020
2121
22-
Pablo Iranzo Gómez <[email protected]> <Pablo.Iranzo@redhat.com>
22+
Pablo Iranzo Gómez <[email protected]> <[email protected].com>
2323
Pablo Iranzo Gómez <[email protected]> <[email protected]>
24+
Pablo Iranzo Gómez <[email protected]> <[email protected]>
2425
25-
26-
2726
2827
2928

0 commit comments

Comments
 (0)