-
Notifications
You must be signed in to change notification settings - Fork 4
44 lines (42 loc) · 1.54 KB
/
update.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
name: controlsFile
on: [push]
jobs:
update:
env:
CONTROLS_FILENAME: controls_SD_TOOL.txt
runs-on: ubuntu-latest
steps:
- name: Extract branch name
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Checkout Repostory
uses: actions/[email protected]
with:
fetch-depth: 0
- name: update controls files
uses: fhem/[email protected]
with:
filename: controls_SD_TOOL.txt
- name: update controls files (append)
uses: fhem/[email protected]
with:
filename: controls_SD_TOOL.txt
writemode: a
directory: FHEM/lib
extension: .json
- name: update CHANGED
run: |
LOG=$(date +"%Y-%m-%d")
LOG+=" - $(git log -1 --pretty=%B)"
echo "$LOG" | cat - CHANGED > temp && mv temp CHANGED
- name: git commit back
run: |
git config --global user.email "[email protected]"
git config --local user.name "GitHub Action"
git add CHANGED ${CONTROLS_FILENAME} || true
git log -n1 --grep="^Automaitc updated controls" --format=format:%H | xargs -n 1 -i{} git log {}~1..HEAD --name-only --pretty=format: | grep -Eo '[0-9]{2}_.*.pm$|*.json$' && git commit CHANGED ${CONTROLS_FILENAME} -m "Automaitc updated controls and CHANGED" || true
- name: git push
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.extract_branch.outputs.branch }}