Skip to content

Commit 0bd0b71

Browse files
authored
Fix license header CI job (#333)
1 parent 6417a7d commit 0bd0b71

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

.github/workflows/fix-license-header.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ name: Fix License Headers
33
on:
44
pull_request_target:
55

6-
permissions:
7-
contents: write
8-
pull-requests: write
9-
106
jobs:
117
header-license-fix:
128
runs-on: ubuntu-20.04
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
1314
steps:
1415
- name: Checkout
1516
uses: actions/checkout@v3
@@ -29,23 +30,35 @@ jobs:
2930
with:
3031
mode: fix
3132

32-
- name: Get modified files in the staging directory
33-
id: changed-files
34-
uses: tj-actions/changed-files@v34
35-
36-
- name: Apply Changes
37-
if: steps.changed-files.outputs.any_changed == 'true'
33+
- name: Commit any changes
3834
shell: bash -l {0}
3935
run: |
40-
git config user.name 'github-actions[bot]'
41-
git config user.email 'github-actions[bot]@users.noreply.github.com'
36+
git config user.name "github-actions[bot]"
37+
git config user.email "github-actions[bot]@users.noreply.github.com"
38+
39+
git pull --no-tags
4240
git add *
43-
git commit -m "Automatic application of license header"
41+
git commit --allow-empty -m "Automatic application of license header"
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Get modified files
46+
id: changed-files
47+
uses: tj-actions/changed-files@v34
48+
with:
49+
base_sha: 'HEAD~1'
50+
sha: 'HEAD'
4451

4552
- name: Push fixes
4653
if: steps.changed-files.outputs.any_changed == 'true'
4754
shell: bash -l {0}
4855
run: |
56+
echo "Changed files"
57+
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
58+
echo " $file"
59+
done
60+
git diff HEAD~1
61+
4962
git config push.default upstream
5063
git push
5164
env:

0 commit comments

Comments
 (0)