test: workflow #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Files to Backend Repository | |
on: | |
pull_request: | |
branches: | |
- master | |
types: | |
- closed # PR이 master에 병합될 때만 | |
jobs: | |
sync_files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Frontend Repository | |
uses: actions/checkout@v3 | |
- name: Install dependencies and build | |
run: | | |
npm install # 또는 yarn install | |
npm run build # 또는 yarn build | |
- name: Sync Files to Backend Repository | |
run: | | |
if [[ "${{ github.event.pull_request.merged }}" == 'true' ]]; then | |
git clone https://westofsky:${{secrets.PAT}}@github.com/Swaggy-Swagger/swagger-custom-java.git | |
cd swagger-custom-java | |
# Git 사용자 정보 설정 | |
git config user.name "${{ github.event.pull_request.user.login }}" | |
git config user.email "${{ github.event.pull_request.user.login }}@users.noreply.github.com" | |
# A 레포지토리에서 B 레포지토리로 파일 복사 | |
cp ../dist/swagger-ui.css src/main/resources/META-INF/resources/webjars/swagger-ui/swagger-ui.css | |
cp ../dist/swagger-ui-bundle.js src/main/resources/META-INF/resources/webjars/swagger-ui/swagger-ui-bundle.js | |
cp ../dist/swagger-ui-standalone-preset.js src/main/resources/META-INF/resources/webjars/swagger-ui/swagger-ui-standalone-preset.js | |
git add . | |
git commit -m "${{ github.event.pull_request.title }}" | |
# Ensure the style/ui branch exists | |
git branch -M style/ui | |
git fetch origin style/ui | |
# Merge changes and override conflicts with ours --allow-unrelated-histories | |
git merge -X ours origin/style/ui | |
# Push the changes to the style/ui branch | |
git push -u origin style/ui | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |