actions
This commit is contained in:
parent
e89b8f7d12
commit
4158688761
16 changed files with 2967 additions and 0 deletions
63
.forgejo/workflows/main.yml
Normal file
63
.forgejo/workflows/main.yml
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
name: Upstream Sync and PR
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Local Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
|
||||||
|
- name: Configure Git
|
||||||
|
run: |
|
||||||
|
git config --global user.name "mizuki"
|
||||||
|
git config --global user.email "akiyama@mizuki.guru"
|
||||||
|
|
||||||
|
- name: Add Upstream and Fetch
|
||||||
|
run: |
|
||||||
|
git remote add upstream https://github.com/cinnyapp/cinny.git
|
||||||
|
git fetch upstream main
|
||||||
|
|
||||||
|
- name: Check for Changes and Push Branch
|
||||||
|
id: check_changes
|
||||||
|
run: |
|
||||||
|
if ! git diff --quiet HEAD upstream/main; then
|
||||||
|
echo "New changes detected in upstream."
|
||||||
|
|
||||||
|
BRANCH_NAME="upstream-sync-$(date +'%Y%m%d%H%M')"
|
||||||
|
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
||||||
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
git checkout -b $BRANCH_NAME
|
||||||
|
git merge upstream/main --no-edit
|
||||||
|
|
||||||
|
git push origin $BRANCH_NAME
|
||||||
|
else
|
||||||
|
echo "No changes detected. Everything is up to date."
|
||||||
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Create Pull Request via Forgejo API
|
||||||
|
if: steps: .check_changes.outputs.has_changes == 'true'
|
||||||
|
run: |
|
||||||
|
PR_TITLE="chore(deps): sync upstream changes ($(date +'%Y-%m-%d'))"
|
||||||
|
PR_BODY="Upstream (cinnyapp/cinny)에 새로운 변경사항이 감지되어 자동으로 생성된 PR입니다."
|
||||||
|
HEAD_BRANCH="${{ steps.check_changes.outputs.branch_name }}"
|
||||||
|
BASE_BRANCH="main"
|
||||||
|
|
||||||
|
curl -X 'POST' \
|
||||||
|
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls" \
|
||||||
|
-H "accept: application/json" \
|
||||||
|
-H "Authorization: token ${{ secrets.TOKEN_FORGEJO }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"base\": \"$BASE_BRANCH\",
|
||||||
|
\"head\": \"$HEAD_BRANCH\",
|
||||||
|
\"title\": \"$PR_TITLE\",
|
||||||
|
\"body\": \"$PR_BODY\"
|
||||||
|
}"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue