From 9775d0d6509ddf8b0f9b445ad6371105ec7985c0 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:37:27 +0000 Subject: [PATCH 1/2] ci: adopt generic workflow authentication without branded secrets Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .github/workflows/npm-audit-fix.yml | 9 ++-- .github/workflows/sync-workflow-templates.yml | 46 +++++-------------- .../sync-workflow-templates.yml.patch | 4 +- 3 files changed, 18 insertions(+), 41 deletions(-) diff --git a/.github/workflows/npm-audit-fix.yml b/.github/workflows/npm-audit-fix.yml index 039d0db..92c92c5 100644 --- a/.github/workflows/npm-audit-fix.yml +++ b/.github/workflows/npm-audit-fix.yml @@ -11,8 +11,8 @@ name: Npm audit fix and compile on: workflow_dispatch: schedule: - # At 2:30 on Sundays - - cron: '30 2 * * 0' + # At 22:30 on Saturdays + - cron: '30 22 * * 6' permissions: contents: read @@ -74,8 +74,8 @@ jobs: if: steps.checkout.outcome == 'success' uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 with: - client-id: ${{ vars.LIBRECODE_WORKFLOW_APP_CLIENT_ID }} - private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }} + client-id: ${{ vars.WORKFLOW_SYNC_APP_CLIENT_ID }} + private-key: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: ${{ github.event.repository.name }} permission-contents: write @@ -95,4 +95,3 @@ jobs: body: ${{ steps.npm-audit.outputs.markdown }} labels: | dependencies - 3. to review diff --git a/.github/workflows/sync-workflow-templates.yml b/.github/workflows/sync-workflow-templates.yml index daa2bfe..6fdc2f8 100644 --- a/.github/workflows/sync-workflow-templates.yml +++ b/.github/workflows/sync-workflow-templates.yml @@ -36,6 +36,9 @@ jobs: contents: write pull-requests: write + env: + AUTH_MODE: ${{ vars.WORKFLOW_SYNC_AUTH_MODE || 'github-app' }} + steps: - name: Check actor permission if: ${{ github.event_name == 'workflow_dispatch' }} @@ -53,24 +56,15 @@ jobs: - name: Validate workflow sync authentication shell: bash env: - AUTH_MODE: ${{ vars.WORKFLOW_SYNC_AUTH_MODE || 'librecode-app' }} - LIBRECODE_APP_CLIENT_ID: ${{ vars.LIBRECODE_WORKFLOW_APP_CLIENT_ID }} - LIBRECODE_APP_PRIVATE_KEY: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }} - CONSUMER_APP_CLIENT_ID: ${{ vars.WORKFLOW_SYNC_APP_CLIENT_ID }} - CONSUMER_APP_PRIVATE_KEY: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }} + APP_CLIENT_ID: ${{ vars.WORKFLOW_SYNC_APP_CLIENT_ID }} + APP_PRIVATE_KEY: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }} CONSUMER_TOKEN: ${{ secrets.WORKFLOW_SYNC_TOKEN }} run: | set -euo pipefail case "${AUTH_MODE}" in - librecode-app) - [[ -n "${LIBRECODE_APP_CLIENT_ID}" && -n "${LIBRECODE_APP_PRIVATE_KEY}" ]] || { - echo "::error::librecode-app requires LIBRECODE_WORKFLOW_APP_CLIENT_ID and LIBRECODE_WORKFLOW_APP_PRIVATE_KEY" - exit 1 - } - ;; github-app) - [[ -n "${CONSUMER_APP_CLIENT_ID}" && -n "${CONSUMER_APP_PRIVATE_KEY}" ]] || { + [[ -n "${APP_CLIENT_ID}" && -n "${APP_PRIVATE_KEY}" ]] || { echo "::error::github-app requires WORKFLOW_SYNC_APP_CLIENT_ID and WORKFLOW_SYNC_APP_PRIVATE_KEY" exit 1 } @@ -89,23 +83,10 @@ jobs: ;; esac - - name: Create LibreCode GitHub App token - if: ${{ vars.WORKFLOW_SYNC_AUTH_MODE == '' || vars.WORKFLOW_SYNC_AUTH_MODE == 'librecode-app' }} - id: librecode-app-token - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 - with: - client-id: ${{ vars.LIBRECODE_WORKFLOW_APP_CLIENT_ID }} - private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: ${{ github.event.repository.name }} - permission-contents: write - permission-pull-requests: write - permission-workflows: write - - - name: Create consumer GitHub App token - if: ${{ vars.WORKFLOW_SYNC_AUTH_MODE == 'github-app' }} - id: consumer-app-token - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + - name: Create GitHub App token + if: ${{ env.AUTH_MODE == 'github-app' }} + id: workflow-app-token + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 with: client-id: ${{ vars.WORKFLOW_SYNC_APP_CLIENT_ID }} private-key: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }} @@ -119,17 +100,14 @@ jobs: id: auth-token shell: bash env: - AUTH_MODE: ${{ vars.WORKFLOW_SYNC_AUTH_MODE || 'librecode-app' }} - LIBRECODE_APP_TOKEN: ${{ steps.librecode-app-token.outputs.token }} - CONSUMER_APP_TOKEN: ${{ steps.consumer-app-token.outputs.token }} + WORKFLOW_APP_TOKEN: ${{ steps.workflow-app-token.outputs.token }} CONSUMER_TOKEN: ${{ secrets.WORKFLOW_SYNC_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -euo pipefail case "${AUTH_MODE}" in - librecode-app) token="${LIBRECODE_APP_TOKEN}" ;; - github-app) token="${CONSUMER_APP_TOKEN}" ;; + github-app) token="${WORKFLOW_APP_TOKEN}" ;; token) token="${CONSUMER_TOKEN}" ;; github-token) token="${GITHUB_TOKEN}" ;; *) exit 1 ;; diff --git a/.github/workflows/sync-workflow-templates.yml.patch b/.github/workflows/sync-workflow-templates.yml.patch index acd0be5..e104efa 100644 --- a/.github/workflows/sync-workflow-templates.yml.patch +++ b/.github/workflows/sync-workflow-templates.yml.patch @@ -1,7 +1,7 @@ -diff --git a/.github/workflows/sync-workflow-templates.yml b/.github/workflows/sync-workflow-templates.yml --- a/.github/workflows/sync-workflow-templates.yml +++ b/.github/workflows/sync-workflow-templates.yml -@@ -170,6 +170,7 @@ +@@ -147,7 +147,8 @@ + with: source: source/workflow-templates target: target catalog-commit: ${{ steps.catalog-revision.outputs.sha }} From e81a0b9694d76dbdf1875b172f5dcdc47969724d Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:37:55 +0000 Subject: [PATCH 2/2] fix(ci): preserve local npm audit schedule and review labels Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .github/workflows/npm-audit-fix.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm-audit-fix.yml b/.github/workflows/npm-audit-fix.yml index 92c92c5..0952637 100644 --- a/.github/workflows/npm-audit-fix.yml +++ b/.github/workflows/npm-audit-fix.yml @@ -11,8 +11,8 @@ name: Npm audit fix and compile on: workflow_dispatch: schedule: - # At 22:30 on Saturdays - - cron: '30 22 * * 6' + # At 2:30 on Sundays + - cron: '30 2 * * 0' permissions: contents: read @@ -95,3 +95,4 @@ jobs: body: ${{ steps.npm-audit.outputs.markdown }} labels: | dependencies + 3. to review