3232 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3333 run : |
3434 repo_list=$(gh repo list $GITHUB_REPOSITORY_OWNER --no-archived --json nameWithOwner --jq ".[].nameWithOwner")
35- echo repo_list=\"$repo_list\" >> $GITHUB_OUTPUT
35+ jq_repo_list=$(jq -c -n '$ARGS.positional' --args ${repo_list[@]})
36+ echo repo_list="$jq_repo_list" >> $GITHUB_OUTPUT
3637
3738 update-coc :
3839 runs-on : ubuntu-latest
@@ -41,18 +42,29 @@ jobs:
4142 matrix :
4243 full_repo : ${{ fromJson(needs.plan-coc-update.outputs.repo_list) }}
4344 steps :
45+ - name : Checkout this repo
46+ uses : actions/checkout@v6
47+ with :
48+ path : sourcerepo
4449 - name : Checkout repo to be updated
4550 uses : actions/checkout@v6
51+ with :
52+ repository : ${{ matrix.full_repo }}
53+ path : targetrepo
54+ token : ${{ secrets.BRUTUS_PAT_TOKEN }}
4655 - name : Update Code of Conduct
4756 env :
4857 GH_TOKEN : ${{ secrets.BRUTUS_PAT_TOKEN }}
4958 run : |
5059 # Ignore changes to this repo
5160 if [[ "${{ matrix.full_repo }}" == "$GITHUB_REPOSITORY" ]]; then
52- echo "Skipping this repository ($GITHUB_REPOSITORY)..."
53- continue
61+ echo "Skipping source repository ($GITHUB_REPOSITORY)..."
62+ exit 0
5463 fi
5564
65+ # Work within target repo
66+ cd targetrepo
67+
5668 # Set the author information to Brutus
5769 git config --local user.email "[email protected] " 5870 git config --local user.name "Brutus (robot)"
6577
6678 # Add the new code of conduct
6779 echo "Replacing Code of Conduct..."
68- cp ../CODE_OF_CONDUCT.md .
80+ cp ../sourcerepo/ CODE_OF_CONDUCT.md .
6981
7082 # Commit and push the update
7183 echo "Syncing updates to remote..."
0 commit comments