Skip to content
Open
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
53 changes: 53 additions & 0 deletions .github/workflows/dispatch-workflow-org.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This workflow needs to be run on demand
# It will update all workflow templates in all repositories of the organization
# This workflow is provided via the organization template repository
#
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Update workflows for all repositories

on:
workflow_dispatch:
permissions:
contents: read
jobs:
get-repos:
runs-on: ubuntu-latest
name: Get all repositories in the organization
outputs:
repositories: ${{ steps.get-repos.outputs.repositories }}
steps:
- name: Check actor permission
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
with:
require: admin

- name: Get all repositories
id: get-repos
env:
GH_TOKEN: ${{ secrets.TEMPLATE_WORKFLOW_DISPATCH_PAT }} # zizmor: ignore[secrets-outside-env]
run: |
repositories=$(gh api \
--paginate \
--jq '[.[] | {name: .name, branch: .default_branch}]' \
orgs/${{ github.repository_owner }}/repos \
| jq -sc 'add')
echo "repositories=$repositories" >> $GITHUB_OUTPUT

dispatch:
runs-on: ubuntu-latest
needs: get-repos
name: Update all workflows in ${{ matrix.repository.name }}
strategy:
fail-fast: false
matrix:
repository: ${{ fromJson(needs.get-repos.outputs.repositories) }}
steps:
- name: Dispatch update workflow
env:
GH_TOKEN: ${{ secrets.TEMPLATE_WORKFLOW_DISPATCH_PAT }} # zizmor: ignore[secrets-outside-env]
run: |
gh workflow run dispatch-workflow-repo.yml \
--repo ${{ github.repository }} \
--field repository=${{ matrix.repository.name }} \
--field branch=${{ matrix.repository.branch }}
1 change: 1 addition & 0 deletions .github/workflows/dispatch-workflow-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:

steps:
- name: Check actor permission
if: github.actor != 'nextcloud-command' # allow matrix call from org dispatch
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
with:
require: admin
Expand Down
Loading