From 6195029b3e0fd5e75750e4fc601a234a069b5db7 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Mon, 15 Dec 2025 09:48:46 -0500 Subject: [PATCH 1/3] Fix using JSON for spawning child workflows --- .github/workflows/coc-update.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coc-update.yml b/.github/workflows/coc-update.yml index 8c4ee57..5fd8baf 100644 --- a/.github/workflows/coc-update.yml +++ b/.github/workflows/coc-update.yml @@ -32,7 +32,8 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | repo_list=$(gh repo list $GITHUB_REPOSITORY_OWNER --no-archived --json nameWithOwner --jq ".[].nameWithOwner") - echo repo_list=\"$repo_list\" >> $GITHUB_OUTPUT + jq_repo_list=$(jq -c -n '$ARGS.positional' --args ${repo_list[@]}) + echo repo_list="$jq_repo_list" >> $GITHUB_OUTPUT update-coc: runs-on: ubuntu-latest From 7724382b21cc9321edd0607f5d318e368bf1941a Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Mon, 15 Dec 2025 09:49:17 -0500 Subject: [PATCH 2/3] Use exit to end workflow early (skip) --- .github/workflows/coc-update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coc-update.yml b/.github/workflows/coc-update.yml index 5fd8baf..c08fb43 100644 --- a/.github/workflows/coc-update.yml +++ b/.github/workflows/coc-update.yml @@ -50,8 +50,8 @@ jobs: run: | # Ignore changes to this repo if [[ "${{ matrix.full_repo }}" == "$GITHUB_REPOSITORY" ]]; then - echo "Skipping this repository ($GITHUB_REPOSITORY)..." - continue + echo "Skipping source repository ($GITHUB_REPOSITORY)..." + exit 0 fi # Set the author information to Brutus From 67d657cb4b78705a16df0e07cb99087df39cba31 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Mon, 15 Dec 2025 09:49:39 -0500 Subject: [PATCH 3/3] Perform checkouts for source and target repositories --- .github/workflows/coc-update.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coc-update.yml b/.github/workflows/coc-update.yml index c08fb43..5783ab3 100644 --- a/.github/workflows/coc-update.yml +++ b/.github/workflows/coc-update.yml @@ -42,8 +42,16 @@ jobs: matrix: full_repo: ${{ fromJson(needs.plan-coc-update.outputs.repo_list) }} steps: + - name: Checkout this repo + uses: actions/checkout@v6 + with: + path: sourcerepo - name: Checkout repo to be updated uses: actions/checkout@v6 + with: + repository: ${{ matrix.full_repo }} + path: targetrepo + token: ${{ secrets.BRUTUS_PAT_TOKEN }} - name: Update Code of Conduct env: GH_TOKEN: ${{ secrets.BRUTUS_PAT_TOKEN }} @@ -54,6 +62,9 @@ jobs: exit 0 fi + # Work within target repo + cd targetrepo + # Set the author information to Brutus git config --local user.email "brutus@beeware.org" git config --local user.name "Brutus (robot)" @@ -66,7 +77,7 @@ jobs: # Add the new code of conduct echo "Replacing Code of Conduct..." - cp ../CODE_OF_CONDUCT.md . + cp ../sourcerepo/CODE_OF_CONDUCT.md . # Commit and push the update echo "Syncing updates to remote..."