Skip to content

Commit 56a19a0

Browse files
sidey79codexactions-user
authored
Update README with installation instructions for FHEM (#11)
* docs: add FHEM installation instructions * workflow: clean generated branch history * Automatic update of controls and CHANGED * workflow: split generated updates from tests * ci: trigger update_controls workflow * Automatic update of controls and CHANGED * workflow: dispatch tests after generated update --------- Co-authored-by: Codex <codex@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com>
1 parent 2c4db8c commit 56a19a0

5 files changed

Lines changed: 139 additions & 62 deletions

File tree

.github/workflows/fhem_test.yml

Lines changed: 10 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
name: FHEM Unit Tests
22

3+
permissions:
4+
contents: read
5+
36
on:
47
pull_request:
58
paths:
69
- 'FHEM/**'
710
- 'lib/**'
8-
- 'contrib/WebAuth/**'
11+
- 'CHANGED'
912
- 'controls_WebAuth.txt'
1013
- 'README.md'
1114
- '.devcontainer/svn-manifest.txt'
@@ -17,7 +20,7 @@ on:
1720
paths:
1821
- 'FHEM/**'
1922
- 'lib/**'
20-
- 'contrib/WebAuth/**'
23+
- 'CHANGED'
2124
- 'controls_WebAuth.txt'
2225
- 'README.md'
2326
- '.devcontainer/svn-manifest.txt'
@@ -26,64 +29,15 @@ on:
2629
- 'scripts/**'
2730
- '.github/workflows/fhem_test.yml'
2831
schedule:
29-
- cron: '43 17 * * 1'
32+
- cron: '33 16 * * 1'
33+
workflow_dispatch:
3034

3135
jobs:
32-
update_controls:
33-
if: github.event_name == 'push'
34-
env:
35-
CONTROLS_FILENAME: controls_${{ github.event.repository.name }}.txt
36-
runs-on: ubuntu-latest
37-
steps:
38-
- name: Extract branch name
39-
id: branch
40-
run: echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
41-
- name: Checkout repository
42-
uses: actions/checkout@v6
43-
with:
44-
fetch-depth: 0
45-
- name: Update controls file
46-
uses: fhem/fhem-controls-actions@v3.0.1
47-
with:
48-
filename: ${{ env.CONTROLS_FILENAME }}
49-
- name: Add authentication helper entries to controls file
50-
uses: fhem/fhem-controls-actions@v3.0.1
51-
with:
52-
filename: ${{ env.CONTROLS_FILENAME }}
53-
directory: lib/FHEM/Core/Authentication
54-
extension: .pm
55-
writemode: a
56-
- name: Update README branch-specific update command
57-
env:
58-
CONTROLS_URL: https://raw.githubusercontent.com/${{ github.repository }}/${{ steps.branch.outputs.name }}/${{ env.CONTROLS_FILENAME }}
59-
run: |
60-
perl -0pi -e 's{<!-- BEGIN GENERATED FHEM UPDATE COMMAND -->\n```text\n.*?\n```\n<!-- END GENERATED FHEM UPDATE COMMAND -->}{<!-- BEGIN GENERATED FHEM UPDATE COMMAND -->\n```text\nupdate add $ENV{CONTROLS_URL}\n```\n<!-- END GENERATED FHEM UPDATE COMMAND -->}s' README.md
61-
- name: Regenerate README module reference
62-
run: perl scripts/update-readme-from-module-docs.pl
63-
- name: Update CHANGED
64-
run: |
65-
log="$(date +'%Y-%m-%d') - $(git log -1 --pretty=%B)"
66-
{
67-
printf '%s\n\n' "$log"
68-
cat CHANGED 2>/dev/null || true
69-
} > CHANGED.new
70-
mv CHANGED.new CHANGED
71-
- name: Commit generated files
72-
run: |
73-
git config --global user.email action@github.com
74-
git config --local user.name 'GitHub Action'
75-
git add CHANGED README.md "${CONTROLS_FILENAME}" || true
76-
if ! git diff --cached --quiet; then
77-
git commit -m 'Automatic update of controls and CHANGED'
78-
fi
79-
- name: Push generated files
80-
uses: ad-m/github-push-action@v1.0.0
81-
with:
82-
github_token: ${{ secrets.BOT_PUSH_TOKEN }}
83-
branch: ${{ steps.branch.outputs.name }}
84-
8536
test:
8637
runs-on: ubuntu-latest
38+
concurrency:
39+
group: ${{ github.workflow }}-test-${{ matrix.perl }}-${{ github.event.pull_request.head.ref || github.ref_name }}
40+
cancel-in-progress: true
8741
strategy:
8842
matrix:
8943
perl: ['5.28', '5.32', '5.38']

.github/workflows/perlCritic.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Perlcritic check
22

3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref_name }}
5+
cancel-in-progress: true
6+
37
on:
48
pull_request:
59
types: [opened, synchronize, reopened]
@@ -8,6 +12,7 @@ on:
812
- 'lib/**'
913
- '.perlcritic'
1014
- '.github/workflows/perlCritic.yml'
15+
workflow_dispatch:
1116

1217
jobs:
1318
critic:
@@ -17,7 +22,7 @@ jobs:
1722
uses: actions/checkout@v6
1823
- uses: shogo82148/actions-setup-perl@v1.38.1
1924
with:
20-
perl-version: '5.32'
25+
perl-version: '5.38'
2126
install-modules-with: cpanm
2227
install-modules: Perl::Critic Task::PerlCriticAllPolicies
2328
install-modules-args: --notest
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Update Generated Files
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref_name }}
5+
cancel-in-progress: true
6+
7+
permissions:
8+
actions: write
9+
contents: read
10+
11+
on:
12+
push:
13+
paths:
14+
- 'FHEM/**'
15+
- 'lib/**'
16+
- 'README.md'
17+
- 'scripts/**'
18+
workflow_dispatch:
19+
20+
jobs:
21+
update_controls:
22+
if: github.event_name != 'push' || github.event.head_commit.message != 'Automatic update of controls and CHANGED'
23+
env:
24+
CONTROLS_FILENAME: controls_${{ github.event.repository.name }}.txt
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Extract branch name
28+
id: branch
29+
run: echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
30+
- name: Checkout repository
31+
uses: actions/checkout@v6
32+
with:
33+
fetch-depth: 0
34+
persist-credentials: false
35+
- name: Update controls file
36+
uses: fhem/fhem-controls-actions@v3.0.1
37+
with:
38+
filename: ${{ env.CONTROLS_FILENAME }}
39+
- name: Add authentication helper entries to controls file
40+
uses: fhem/fhem-controls-actions@v3.0.1
41+
with:
42+
filename: ${{ env.CONTROLS_FILENAME }}
43+
directory: lib/FHEM/Core/Authentication
44+
extension: .pm
45+
writemode: a
46+
- name: Update README branch-specific update command
47+
env:
48+
CONTROLS_URL: https://raw.githubusercontent.com/${{ github.repository }}/${{ steps.branch.outputs.name }}/${{ env.CONTROLS_FILENAME }}
49+
run: |
50+
perl -0pi -e 's{(<!-- BEGIN GENERATED FHEM UPDATE URL: one-shot -->\n```text\nupdate all )\S+(\n```\n<!-- END GENERATED FHEM UPDATE URL: one-shot -->)}{$1$ENV{CONTROLS_URL}$2}s; s{(<!-- BEGIN GENERATED FHEM UPDATE URL: persistent -->\n```text\nupdate add )\S+(\n```\n<!-- END GENERATED FHEM UPDATE URL: persistent -->)}{$1$ENV{CONTROLS_URL}$2}s' README.md
51+
- name: Regenerate README module reference
52+
run: perl scripts/update-readme-from-module-docs.pl
53+
- name: Update CHANGED
54+
run: |
55+
log="$(date +'%Y-%m-%d') - $(git log -1 --pretty=%B)"
56+
{
57+
printf '%s\n\n' "$log"
58+
cat CHANGED 2>/dev/null || true
59+
} > CHANGED.new
60+
mv CHANGED.new CHANGED
61+
- name: Commit generated files
62+
id: commit_generated
63+
run: |
64+
git config --local user.email action@github.com
65+
git config --local user.name 'GitHub Action'
66+
git add CHANGED README.md "${CONTROLS_FILENAME}" || true
67+
if ! git diff --cached --quiet; then
68+
git commit -m 'Automatic update of controls and CHANGED'
69+
echo "created=true" >> "$GITHUB_OUTPUT"
70+
else
71+
echo "created=false" >> "$GITHUB_OUTPUT"
72+
fi
73+
- name: Push generated files
74+
if: steps.commit_generated.outputs.created == 'true'
75+
env:
76+
BOT_PUSH_TOKEN: ${{ secrets.BOT_PUSH_TOKEN }}
77+
BRANCH_NAME: ${{ steps.branch.outputs.name }}
78+
run: |
79+
echo "::add-mask::$BOT_PUSH_TOKEN"
80+
git remote set-url origin "https://x-access-token:${BOT_PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
81+
git push origin "HEAD:${BRANCH_NAME}"
82+
- name: Trigger tests for generated branch head
83+
if: steps.commit_generated.outputs.created == 'true'
84+
uses: actions/github-script@v8
85+
with:
86+
script: |
87+
await github.rest.actions.createWorkflowDispatch({
88+
owner: context.repo.owner,
89+
repo: context.repo.repo,
90+
workflow_id: 'fhem_test.yml',
91+
ref: process.env.BRANCH_NAME,
92+
});
93+
env:
94+
BRANCH_NAME: ${{ steps.branch.outputs.name }}

CHANGED

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2026-04-04 - ci: trigger update_controls workflow
2+
3+
2026-04-04 - workflow: clean generated branch history
4+
5+
2026-04-04 - workflow: stabilize generated branch updates
6+
7+
2026-04-04 - docs: add FHEM installation instructions
8+
19
2026-04-03 - Merge pull request #10 from fhem/codex/trusted-proxy-dns
210

311
[codex] Resolve trustedProxy hostnames via DNS

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,29 @@ Perl dependencies are split into two layers:
107107
The task `FHEM: Sync Module -> SVN` syncs only the paths listed in
108108
`.devcontainer/svn-manifest.txt`.
109109

110-
## FHEM Update
110+
111+
## Installation
111112

112113
The GitHub workflow generates [`controls_WebAuth.txt`](/workspace/WebAuth/controls_WebAuth.txt)
113-
per branch. To add this branch as an update source in FHEM, use:
114+
per branch.
115+
116+
<!-- trigger update_controls -->
117+
### One-shot Installation (no persistent update source)
118+
119+
Installs the module module without registering the update source in FHEM:
120+
121+
<!-- BEGIN GENERATED FHEM UPDATE URL: one-shot -->
122+
```text
123+
update all https://raw.githubusercontent.com/fhem/WebAuth/feat/InstallDocs/controls_WebAuth.txt
124+
```
125+
<!-- END GENERATED FHEM UPDATE URL: one-shot -->
126+
127+
### Persistent Installation
128+
129+
To add this branch as an persistent update source in FHEM, use:
114130

115-
<!-- BEGIN GENERATED FHEM UPDATE COMMAND -->
131+
<!-- BEGIN GENERATED FHEM UPDATE URL: persistent -->
116132
```text
117-
update add https://raw.githubusercontent.com/fhem/WebAuth/main/controls_WebAuth.txt
133+
update add https://raw.githubusercontent.com/fhem/WebAuth/feat/InstallDocs/controls_WebAuth.txt
118134
```
119-
<!-- END GENERATED FHEM UPDATE COMMAND -->
135+
<!-- END GENERATED FHEM UPDATE URL: persistent -->

0 commit comments

Comments
 (0)