Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 10 additions & 56 deletions .github/workflows/fhem_test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: FHEM Unit Tests

permissions:
contents: read

on:
pull_request:
paths:
- 'FHEM/**'
- 'lib/**'
- 'contrib/WebAuth/**'
- 'CHANGED'
- 'controls_WebAuth.txt'
- 'README.md'
- '.devcontainer/svn-manifest.txt'
Expand All @@ -17,7 +20,7 @@ on:
paths:
- 'FHEM/**'
- 'lib/**'
- 'contrib/WebAuth/**'
- 'CHANGED'
- 'controls_WebAuth.txt'
- 'README.md'
- '.devcontainer/svn-manifest.txt'
Expand All @@ -26,64 +29,15 @@ on:
- 'scripts/**'
- '.github/workflows/fhem_test.yml'
schedule:
- cron: '43 17 * * 1'
- cron: '33 16 * * 1'
workflow_dispatch:

jobs:
update_controls:
if: github.event_name == 'push'
env:
CONTROLS_FILENAME: controls_${{ github.event.repository.name }}.txt
runs-on: ubuntu-latest
steps:
- name: Extract branch name
id: branch
run: echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Update controls file
uses: fhem/fhem-controls-actions@v3.0.1
with:
filename: ${{ env.CONTROLS_FILENAME }}
- name: Add authentication helper entries to controls file
uses: fhem/fhem-controls-actions@v3.0.1
with:
filename: ${{ env.CONTROLS_FILENAME }}
directory: lib/FHEM/Core/Authentication
extension: .pm
writemode: a
- name: Update README branch-specific update command
env:
CONTROLS_URL: https://raw.githubusercontent.com/${{ github.repository }}/${{ steps.branch.outputs.name }}/${{ env.CONTROLS_FILENAME }}
run: |
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
- name: Regenerate README module reference
run: perl scripts/update-readme-from-module-docs.pl
- name: Update CHANGED
run: |
log="$(date +'%Y-%m-%d') - $(git log -1 --pretty=%B)"
{
printf '%s\n\n' "$log"
cat CHANGED 2>/dev/null || true
} > CHANGED.new
mv CHANGED.new CHANGED
- name: Commit generated files
run: |
git config --global user.email action@github.com
git config --local user.name 'GitHub Action'
git add CHANGED README.md "${CONTROLS_FILENAME}" || true
if ! git diff --cached --quiet; then
git commit -m 'Automatic update of controls and CHANGED'
fi
- name: Push generated files
uses: ad-m/github-push-action@v1.0.0
with:
github_token: ${{ secrets.BOT_PUSH_TOKEN }}
branch: ${{ steps.branch.outputs.name }}

test:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-test-${{ matrix.perl }}-${{ github.event.pull_request.head.ref || github.ref_name }}
cancel-in-progress: true
strategy:
matrix:
perl: ['5.28', '5.32', '5.38']
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/perlCritic.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Perlcritic check

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref_name }}
cancel-in-progress: true

on:
pull_request:
types: [opened, synchronize, reopened]
Expand All @@ -8,6 +12,7 @@ on:
- 'lib/**'
- '.perlcritic'
- '.github/workflows/perlCritic.yml'
workflow_dispatch:

jobs:
critic:
Expand All @@ -17,7 +22,7 @@ jobs:
uses: actions/checkout@v6
- uses: shogo82148/actions-setup-perl@v1.38.1
with:
perl-version: '5.32'
perl-version: '5.38'
install-modules-with: cpanm
install-modules: Perl::Critic Task::PerlCriticAllPolicies
install-modules-args: --notest
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/update_controls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Update Generated Files

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

permissions:
actions: write
contents: read

on:
push:
paths:
- 'FHEM/**'
- 'lib/**'
- 'README.md'
- 'scripts/**'
workflow_dispatch:

jobs:
update_controls:
if: github.event_name != 'push' || github.event.head_commit.message != 'Automatic update of controls and CHANGED'
env:
CONTROLS_FILENAME: controls_${{ github.event.repository.name }}.txt
runs-on: ubuntu-latest
steps:
- name: Extract branch name
id: branch
run: echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Update controls file
uses: fhem/fhem-controls-actions@v3.0.1
with:
filename: ${{ env.CONTROLS_FILENAME }}
- name: Add authentication helper entries to controls file
uses: fhem/fhem-controls-actions@v3.0.1
with:
filename: ${{ env.CONTROLS_FILENAME }}
directory: lib/FHEM/Core/Authentication
extension: .pm
writemode: a
- name: Update README branch-specific update command
env:
CONTROLS_URL: https://raw.githubusercontent.com/${{ github.repository }}/${{ steps.branch.outputs.name }}/${{ env.CONTROLS_FILENAME }}
run: |
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
- name: Regenerate README module reference
run: perl scripts/update-readme-from-module-docs.pl
- name: Update CHANGED
run: |
log="$(date +'%Y-%m-%d') - $(git log -1 --pretty=%B)"
{
printf '%s\n\n' "$log"
cat CHANGED 2>/dev/null || true
} > CHANGED.new
mv CHANGED.new CHANGED
- name: Commit generated files
id: commit_generated
run: |
git config --local user.email action@github.com
git config --local user.name 'GitHub Action'
git add CHANGED README.md "${CONTROLS_FILENAME}" || true
if ! git diff --cached --quiet; then
git commit -m 'Automatic update of controls and CHANGED'
echo "created=true" >> "$GITHUB_OUTPUT"
else
echo "created=false" >> "$GITHUB_OUTPUT"
fi
- name: Push generated files
if: steps.commit_generated.outputs.created == 'true'
env:
BOT_PUSH_TOKEN: ${{ secrets.BOT_PUSH_TOKEN }}
BRANCH_NAME: ${{ steps.branch.outputs.name }}
run: |
echo "::add-mask::$BOT_PUSH_TOKEN"
git remote set-url origin "https://x-access-token:${BOT_PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git push origin "HEAD:${BRANCH_NAME}"
- name: Trigger tests for generated branch head
if: steps.commit_generated.outputs.created == 'true'
uses: actions/github-script@v8
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'fhem_test.yml',
ref: process.env.BRANCH_NAME,
});
env:
BRANCH_NAME: ${{ steps.branch.outputs.name }}
8 changes: 8 additions & 0 deletions CHANGED
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2026-04-04 - ci: trigger update_controls workflow

2026-04-04 - workflow: clean generated branch history

2026-04-04 - workflow: stabilize generated branch updates

2026-04-04 - docs: add FHEM installation instructions

2026-04-03 - Merge pull request #10 from fhem/codex/trusted-proxy-dns

[codex] Resolve trustedProxy hostnames via DNS
Expand Down
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,29 @@ Perl dependencies are split into two layers:
The task `FHEM: Sync Module -> SVN` syncs only the paths listed in
`.devcontainer/svn-manifest.txt`.

## FHEM Update

## Installation

The GitHub workflow generates [`controls_WebAuth.txt`](/workspace/WebAuth/controls_WebAuth.txt)
per branch. To add this branch as an update source in FHEM, use:
per branch.

<!-- trigger update_controls -->
### One-shot Installation (no persistent update source)

Installs the module module without registering the update source in FHEM:

<!-- BEGIN GENERATED FHEM UPDATE URL: one-shot -->
```text
update all https://raw.githubusercontent.com/fhem/WebAuth/feat/InstallDocs/controls_WebAuth.txt
```
<!-- END GENERATED FHEM UPDATE URL: one-shot -->

### Persistent Installation

To add this branch as an persistent update source in FHEM, use:

<!-- BEGIN GENERATED FHEM UPDATE COMMAND -->
<!-- BEGIN GENERATED FHEM UPDATE URL: persistent -->
```text
update add https://raw.githubusercontent.com/fhem/WebAuth/main/controls_WebAuth.txt
update add https://raw.githubusercontent.com/fhem/WebAuth/feat/InstallDocs/controls_WebAuth.txt
```
<!-- END GENERATED FHEM UPDATE COMMAND -->
<!-- END GENERATED FHEM UPDATE URL: persistent -->