mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-13 02:54:37 +08:00
PRs
This commit is contained in:
38
.github/workflows/review_pull_request.yaml
vendored
38
.github/workflows/review_pull_request.yaml
vendored
@@ -1,38 +0,0 @@
|
||||
name: Review Pull Request
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, reopened]
|
||||
|
||||
env:
|
||||
EXPECTED_BRANCH: "MAKE-PRS-HERE"
|
||||
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
pr_check:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.actor != 'FrogAi' }}
|
||||
steps:
|
||||
- name: Validate Target Branch
|
||||
env:
|
||||
GH_TOKEN: ${{ env.GIT_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
REPO: ${{ github.repository }}
|
||||
TARGET_BRANCH: ${{ github.base_ref }}
|
||||
run: |
|
||||
if [ "$TARGET_BRANCH" != "$EXPECTED_BRANCH" ]; then
|
||||
echo "Invalid target branch: $TARGET_BRANCH"
|
||||
|
||||
gh pr comment "$PR_NUMBER" --repo "$REPO" \
|
||||
--body "Please submit your pull request to the \"$EXPECTED_BRANCH\" branch."
|
||||
|
||||
gh pr close "$PR_NUMBER" --repo "$REPO"
|
||||
else
|
||||
echo "Valid target branch."
|
||||
|
||||
gh pr comment "$PR_NUMBER" --repo "$REPO" \
|
||||
--body "Thank you for your PR! If you're not already in the StarPilot Discord, [feel free to join](https://discord.StarPilot.com) and let me know you've opened a PR!"
|
||||
fi
|
||||
97
.github/workflows/update_pr_branch.yaml
vendored
97
.github/workflows/update_pr_branch.yaml
vendored
@@ -1,97 +0,0 @@
|
||||
name: Update MAKE-PRS-HERE
|
||||
run-name: Update MAKE-PRS-HERE
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- StarPilot-Testing
|
||||
|
||||
env:
|
||||
GIT_EMAIL: "91348155+FrogAi@users.noreply.github.com"
|
||||
GIT_NAME: "James"
|
||||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
SOURCE_BRANCH: StarPilot-Testing
|
||||
TARGET_BRANCH: MAKE-PRS-HERE
|
||||
TZ: America/Phoenix
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update_branch:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ env.SOURCE_BRANCH }}
|
||||
fetch-depth: 5
|
||||
token: ${{ env.GITHUB_TOKEN }}
|
||||
|
||||
- name: Configure Git Identity
|
||||
run: |
|
||||
git config --global user.name "$GIT_NAME"
|
||||
git config --global user.email "$GIT_EMAIL"
|
||||
|
||||
- name: Revert "Compile StarPilot"
|
||||
id: prepare_source
|
||||
run: |
|
||||
COMPILE_COMMIT=$(git rev-list HEAD -n 1 --grep="Compile StarPilot" || true)
|
||||
|
||||
if [ -n "$COMPILE_COMMIT" ]; then
|
||||
echo "Found 'Compile StarPilot' at $COMPILE_COMMIT. Reverting..."
|
||||
git revert --no-edit "$COMPILE_COMMIT"
|
||||
else
|
||||
echo "Compile commit not found. Proceeding with current source state."
|
||||
fi
|
||||
|
||||
echo "source_state=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Checkout Target
|
||||
run: |
|
||||
git fetch origin "$TARGET_BRANCH" --depth=2
|
||||
git checkout "$TARGET_BRANCH"
|
||||
|
||||
- name: Sync Files from Source to Target
|
||||
env:
|
||||
SOURCE_STATE: ${{ steps.prepare_source.outputs.source_state }}
|
||||
run: |
|
||||
git rm -r --ignore-unmatch .
|
||||
git clean -fdx
|
||||
|
||||
git checkout "$SOURCE_STATE" -- .
|
||||
|
||||
rm -f .github/update_date
|
||||
git add --all
|
||||
|
||||
- name: Commit and Push
|
||||
env:
|
||||
REPO_NAME: ${{ github.repository }}
|
||||
run: |
|
||||
if git diff --staged --quiet; then
|
||||
echo "Working tree is clean. No changes to commit."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
DAY=$(TZ="$TZ" date +'%d' | sed 's/^0//')
|
||||
case "$DAY" in
|
||||
1|21|31) SUFFIX="st" ;;
|
||||
2|22) SUFFIX="nd" ;;
|
||||
3|23) SUFFIX="rd" ;;
|
||||
*) SUFFIX="th" ;;
|
||||
esac
|
||||
|
||||
MONTH=$(TZ="$TZ" date +'%B')
|
||||
YEAR=$(TZ="$TZ" date +'%Y')
|
||||
COMMIT_MSG="${MONTH} ${DAY}${SUFFIX}, ${YEAR} Update"
|
||||
|
||||
if git log -1 --pretty=%s | grep -q "$COMMIT_MSG"; then
|
||||
echo "Amending previous commit: $COMMIT_MSG"
|
||||
git commit --amend --no-edit
|
||||
else
|
||||
echo "Creating new commit: $COMMIT_MSG"
|
||||
git commit -m "$COMMIT_MSG"
|
||||
fi
|
||||
|
||||
git remote set-url origin "https://${GITHUB_TOKEN}@github.com/${REPO_NAME}"
|
||||
git push origin "$TARGET_BRANCH" --force
|
||||
Reference in New Issue
Block a user