Skip to content
Merged
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
26 changes: 19 additions & 7 deletions .github/workflows/sync-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ jobs:
repository:
- .github
steps:
- name: Checkout source repository
uses: actions/checkout@v5
with:
path: source

- name: Create GitHub App token
uses: actions/create-github-app-token@v2
id: gh-app-token
Expand All @@ -33,7 +28,23 @@ jobs:
path: target
token: ${{ steps.gh-app-token.outputs.token }}

- name: Decide whether to sync files
id: decide
run: |
if [ -f target/.github/sync.yaml ]; then
echo "sync=true" >> $GITHUB_OUTPUT
else
echo "sync=false" >> $GITHUB_OUTPUT
fi

- name: Checkout source repository
if: steps.decide.outputs.sync == 'true'
uses: actions/checkout@v5
with:
path: source

- name: Copy files
if: steps.decide.outputs.sync == 'true'
run: |
yq -r '.copy[]' target/.github/sync.yaml | while IFS= read -r file; do
source_file="source/$file"
Expand All @@ -43,6 +54,7 @@ jobs:
done

- name: Detect sync updates
if: steps.decide.outputs.sync == 'true'
id: updates
working-directory: target
run: |
Expand All @@ -53,14 +65,14 @@ jobs:
fi

- name: Output short commit SHA
if: steps.updates.outputs.updated == 'true'
if: steps.decide.outputs.sync == 'true' && steps.updates.outputs.updated == 'true'
id: sha
working-directory: target
run: |
echo "short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Create Pull Request with applied automatic fixes
if: steps.updates.outputs.updated == 'true'
if: steps.decide.outputs.sync == 'true' && steps.updates.outputs.updated == 'true'
uses: peter-evans/create-pull-request@v7
with:
path: target
Expand Down