From 3816c72389e80c7daf9b22e9517016018fa12b19 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 4 Apr 2026 23:02:45 +0200 Subject: [PATCH 1/7] docs: add FHEM installation instructions --- .github/workflows/fhem_test.yml | 35 +++++++++++++++++++++++--------- .github/workflows/perlCritic.yml | 7 ++++++- README.md | 25 ++++++++++++++++++----- 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/.github/workflows/fhem_test.yml b/.github/workflows/fhem_test.yml index 89e0ecb..17bb3ab 100644 --- a/.github/workflows/fhem_test.yml +++ b/.github/workflows/fhem_test.yml @@ -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' @@ -17,7 +20,7 @@ on: paths: - 'FHEM/**' - 'lib/**' - - 'contrib/WebAuth/**' + - 'CHANGED' - 'controls_WebAuth.txt' - 'README.md' - '.devcontainer/svn-manifest.txt' @@ -26,11 +29,12 @@ 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' + 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 @@ -42,6 +46,7 @@ jobs: uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - name: Update controls file uses: fhem/fhem-controls-actions@v3.0.1 with: @@ -57,7 +62,7 @@ jobs: env: CONTROLS_URL: https://raw.githubusercontent.com/${{ github.repository }}/${{ steps.branch.outputs.name }}/${{ env.CONTROLS_FILENAME }} run: | - perl -0pi -e 's{\n```text\n.*?\n```\n}{\n```text\nupdate add $ENV{CONTROLS_URL}\n```\n}s' README.md + perl -0pi -e 's{(\n```text\nupdate all )\S+(\n```\n)}{$1$ENV{CONTROLS_URL}$2}s; s{(\n```text\nupdate add )\S+(\n```\n)}{$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 @@ -69,21 +74,31 @@ jobs: } > CHANGED.new mv CHANGED.new CHANGED - name: Commit generated files + id: commit_generated 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' + echo "created=true" >> "$GITHUB_OUTPUT" + else + echo "created=false" >> "$GITHUB_OUTPUT" 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 }} - + 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}" 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'] diff --git a/.github/workflows/perlCritic.yml b/.github/workflows/perlCritic.yml index edeb890..8cf9bf4 100644 --- a/.github/workflows/perlCritic.yml +++ b/.github/workflows/perlCritic.yml @@ -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] @@ -8,6 +12,7 @@ on: - 'lib/**' - '.perlcritic' - '.github/workflows/perlCritic.yml' + workflow_dispatch: jobs: critic: @@ -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 diff --git a/README.md b/README.md index 74792bc..96cd51e 100644 --- a/README.md +++ b/README.md @@ -107,13 +107,28 @@ 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. + +### One-shot Installation (no persistent update source) + +Installs the module module without registering the update source in FHEM: + + +```text +update all https://raw.githubusercontent.com/fhem/WebAuth/feat/InstallDocs/controls_WebAuth.txt +``` + + +### Persistent Installation + +To add this branch as an persistent update source in FHEM, use: - + ```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 ``` - + From a824625030d61750006c7a9f8df6d9f62830b88e Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 4 Apr 2026 23:02:55 +0200 Subject: [PATCH 2/7] workflow: clean generated branch history --- CHANGED | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGED b/CHANGED index b609245..84d4524 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,7 @@ +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 From 189e9d5b1d92fe766630ce114a0476da22ca7e85 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 4 Apr 2026 21:03:06 +0000 Subject: [PATCH 3/7] Automatic update of controls and CHANGED --- CHANGED | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGED b/CHANGED index 84d4524..2a1f1af 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,5 @@ +2026-04-04 - workflow: clean generated branch history + 2026-04-04 - workflow: stabilize generated branch updates 2026-04-04 - docs: add FHEM installation instructions From 025842991c696ea2c6133e28d69b901eaf5fa879 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 4 Apr 2026 23:10:23 +0200 Subject: [PATCH 4/7] workflow: split generated updates from tests --- .github/workflows/fhem_test.yml | 61 -------------------- .github/workflows/update_controls.yml | 80 +++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/update_controls.yml diff --git a/.github/workflows/fhem_test.yml b/.github/workflows/fhem_test.yml index 17bb3ab..24ff8c1 100644 --- a/.github/workflows/fhem_test.yml +++ b/.github/workflows/fhem_test.yml @@ -33,67 +33,6 @@ on: 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{(\n```text\nupdate all )\S+(\n```\n)}{$1$ENV{CONTROLS_URL}$2}s; s{(\n```text\nupdate add )\S+(\n```\n)}{$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 --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' - 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}" test: runs-on: ubuntu-latest concurrency: diff --git a/.github/workflows/update_controls.yml b/.github/workflows/update_controls.yml new file mode 100644 index 0000000..e09a4d1 --- /dev/null +++ b/.github/workflows/update_controls.yml @@ -0,0 +1,80 @@ +name: Update Generated Files + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +permissions: + 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{(\n```text\nupdate all )\S+(\n```\n)}{$1$ENV{CONTROLS_URL}$2}s; s{(\n```text\nupdate add )\S+(\n```\n)}{$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}" From e24bdb28049ede70b8fb3a42967e95f78c0a3475 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 4 Apr 2026 23:15:21 +0200 Subject: [PATCH 5/7] ci: trigger update_controls workflow --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 96cd51e..ed14546 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ The task `FHEM: Sync Module -> SVN` syncs only the paths listed in The GitHub workflow generates [`controls_WebAuth.txt`](/workspace/WebAuth/controls_WebAuth.txt) per branch. + ### One-shot Installation (no persistent update source) Installs the module module without registering the update source in FHEM: From 4c10e5ffb35f4a9712740f14721e3b2819de8d5a Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 4 Apr 2026 21:15:34 +0000 Subject: [PATCH 6/7] Automatic update of controls and CHANGED --- CHANGED | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGED b/CHANGED index 2a1f1af..7768c07 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,5 @@ +2026-04-04 - ci: trigger update_controls workflow + 2026-04-04 - workflow: clean generated branch history 2026-04-04 - workflow: stabilize generated branch updates From 6564388f16c47282ae97c02aa6be2308d2c05df6 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 4 Apr 2026 23:18:45 +0200 Subject: [PATCH 7/7] workflow: dispatch tests after generated update --- .github/workflows/update_controls.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/update_controls.yml b/.github/workflows/update_controls.yml index e09a4d1..f19d630 100644 --- a/.github/workflows/update_controls.yml +++ b/.github/workflows/update_controls.yml @@ -5,6 +5,7 @@ concurrency: cancel-in-progress: true permissions: + actions: write contents: read on: @@ -78,3 +79,16 @@ jobs: 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 }}