Skip to content

Commit f214d52

Browse files
authored
sync: two more fixes (#28)
First: Following the pattern from coreos/repo-templates, use a hardcoded committer/author identity for the sync commits rather than trying to dynamically fetch it from the GitHub API. GitHub App installation tokens don't have access to the endpoints needed to get app/bot identity information. Second: Fix our sync to sync all of the common files, and handle file deletion. Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Colin Walters <[email protected]>
1 parent 98b9323 commit f214d52

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

.github/workflows/sync-common.yml

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,28 +97,17 @@ jobs:
9797
name: common-files
9898
path: common-files
9999

100-
- name: Get bot user info
101-
id: bot-user
102-
uses: actions/github-script@v8
103-
with:
104-
github-token: ${{ steps.token.outputs.token }}
105-
script: |
106-
const app = await github.rest.apps.getAuthenticated();
107-
console.log('Bot app:', app.data);
108-
const botName = `${app.data.slug}[bot]`;
109-
const botEmail = `${app.data.id}+${app.data.slug}[bot]@users.noreply.github.com`;
110-
core.setOutput('name', botName);
111-
core.setOutput('email', botEmail);
112-
113100
- name: Sync common files to repository
114101
run: |
115-
# Create target directory if it doesn't exist
116-
mkdir -p repo/.gemini
102+
# First pass: copy all files
103+
rsync -rlv common-files/ repo/
117104
118-
# Copy files from common to repo
119-
if [ -d common-files/.gemini ]; then
120-
cp -r common-files/.gemini/* repo/.gemini/
121-
fi
105+
# Second pass: for each subdirectory in common-files, use --delete
106+
# to remove files that no longer exist in the source
107+
find common-files -mindepth 1 -maxdepth 1 -type d | while read -r dir; do
108+
subdir="${dir#common-files/}"
109+
rsync -rlv --delete "common-files/$subdir/" "repo/$subdir/"
110+
done
122111
123112
- name: Open pull request
124113
uses: peter-evans/create-pull-request@v7
@@ -137,5 +126,6 @@ jobs:
137126
This PR synchronizes common files from the [infra repository](${{ github.server_url }}/${{ github.repository }}/tree/main/common).
138127
139128
Synchronized from ${{ github.repository }}@${{ github.sha }}.
140-
committer: "${{ steps.bot-user.outputs.name }} <${{ steps.bot-user.outputs.email }}>"
141-
author: "${{ steps.bot-user.outputs.name }} <${{ steps.bot-user.outputs.email }}>"
129+
committer: "bootc-dev Bot <[email protected]>"
130+
author: "bootc-dev Bot <[email protected]>"
131+
signoff: true

0 commit comments

Comments
 (0)