diff --git a/.github/workflows/coverage-publish.yml b/.github/workflows/coverage-publish.yml index 3c2ecbe313..83e7c74e05 100644 --- a/.github/workflows/coverage-publish.yml +++ b/.github/workflows/coverage-publish.yml @@ -48,8 +48,8 @@ jobs: id: coverage-token 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: LibreSign repositories: coverage permission-contents: write diff --git a/.github/workflows/npm-audit-fix.yml b/.github/workflows/npm-audit-fix.yml index a6b263cb3d..4abe50b7b2 100644 --- a/.github/workflows/npm-audit-fix.yml +++ b/.github/workflows/npm-audit-fix.yml @@ -77,8 +77,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 diff --git a/.github/workflows/npm-audit-fix.yml.patch b/.github/workflows/npm-audit-fix.yml.patch index 6019690d3d..a31a39f766 100644 --- a/.github/workflows/npm-audit-fix.yml.patch +++ b/.github/workflows/npm-audit-fix.yml.patch @@ -24,6 +24,15 @@ name: npm-audit-fix-${{ matrix.branches }} +@@ -83,7 +86,7 @@ + + - name: Create Pull Request + if: steps.checkout.outcome == 'success' +- uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 ++ uses: peter-evans/create-pull-request@3ffccacd46053766916f087ce41d627c0b8cf2d1 # v8.1.3 + with: + token: ${{ steps.app-token.outputs.token }} + commit-message: 'fix(deps): resolve npm audit vulnerabilities' @@ -95,3 +98,4 @@ body: ${{ steps.npm-audit.outputs.markdown }} labels: | diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index b618005b34..c0dc2c1c6f 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -98,7 +98,7 @@ jobs: config-path: .nextcloud-release.yml actor: ${{ github.actor }} github-token: ${{ secrets.GITHUB_TOKEN }} - app-private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }} + app-private-key: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }} pipeline-reference-ref: refs/remotes/origin/main post_merge: @@ -139,7 +139,7 @@ jobs: config-path: .nextcloud-release.yml prepare-workflow-path: .github/workflows/prepare-release.yml github-token: ${{ secrets.GITHUB_TOKEN }} - app-private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }} + app-private-key: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }} verify_publication: name: Verify published release diff --git a/.github/workflows/probe-release-app-workflows-permission.yml b/.github/workflows/probe-release-app-workflows-permission.yml index 7852e12ea1..7037a8f566 100644 --- a/.github/workflows/probe-release-app-workflows-permission.yml +++ b/.github/workflows/probe-release-app-workflows-permission.yml @@ -36,7 +36,7 @@ jobs: uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 with: client-id: ${{ steps.app.outputs.client-id }} - private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }} + private-key: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }} owner: LibreSign repositories: libresign permission-contents: write diff --git a/.github/workflows/resume-release.yml b/.github/workflows/resume-release.yml index 22371b8eee..2cf1107d74 100644 --- a/.github/workflows/resume-release.yml +++ b/.github/workflows/resume-release.yml @@ -59,4 +59,4 @@ jobs: config-path: .nextcloud-release.yml prepare-workflow-path: .github/workflows/prepare-release.yml github-token: ${{ secrets.GITHUB_TOKEN }} - app-private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }} + app-private-key: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }} diff --git a/.github/workflows/sync-workflow-templates.yml b/.github/workflows/sync-workflow-templates.yml index 3e3da3a52a..257e21990e 100644 --- a/.github/workflows/sync-workflow-templates.yml +++ b/.github/workflows/sync-workflow-templates.yml @@ -39,6 +39,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' }} @@ -56,24 +59,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 } @@ -92,22 +86,9 @@ 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@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.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 + - 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 }} @@ -122,17 +103,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 ;; @@ -176,7 +154,7 @@ jobs: - name: Create Pull Request if: ${{ steps.sync.outputs.changed == 'true' }} - uses: peter-evans/create-pull-request@3ffccacd46053766916f087ce41d627c0b8cf2d1 # v8.1.3 + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 with: token: ${{ steps.auth-token.outputs.token }} commit-message: 'ci(actions): Update workflow templates from organization template repository' diff --git a/.github/workflows/sync-workflow-templates.yml.patch b/.github/workflows/sync-workflow-templates.yml.patch index 232bf51b05..7e8fb9c50e 100644 --- a/.github/workflows/sync-workflow-templates.yml.patch +++ b/.github/workflows/sync-workflow-templates.yml.patch @@ -1,6 +1,7 @@ --- a/.github/workflows/sync-workflow-templates.yml +++ b/.github/workflows/sync-workflow-templates.yml -@@ -27,6 +27,9 @@ jobs: +@@ -28,7 +28,10 @@ + fail-fast: false matrix: branches: - ${{ github.event.repository.default_branch }} @@ -9,3 +10,4 @@ + - stable33 name: Update workflows in ${{ matrix.branches }} +