Fixing env variables

This commit is contained in:
XargonWan 2024-11-05 22:58:19 +09:00
parent f359169df5
commit 121f635286

View file

@ -47,38 +47,38 @@ jobs:
env: env:
BRANCH_NAME: "sync-${{ github.run_id }}" # Temporary branch name for the PR BRANCH_NAME: "sync-${{ github.run_id }}" # Temporary branch name for the PR
run: | run: |
echo "Syncing from upstream repository $UPSTREAM_REPO on branch $TARGET_BRANCH" echo "Syncing from upstream repository ${{ env.UPSTREAM_REPO }} on branch ${{ env.TARGET_BRANCH }}"
# Perform fetch and merge, attempting to resolve conflicts by preferring the upstream changes # Perform fetch and merge, attempting to resolve conflicts by preferring the upstream changes
git fetch "$UPSTREAM_REPO" "$TARGET_BRANCH" git fetch "${{ env.UPSTREAM_REPO }}" "${{ env.TARGET_BRANCH }}"
git checkout -b "$BRANCH_NAME" git checkout -b "$BRANCH_NAME"
# Attempt to merge, allowing conflicts # Attempt to merge, allowing conflicts
if ! git merge FETCH_HEAD -m "Merge changes from upstream $UPSTREAM_REPO/$TARGET_BRANCH"; then if ! git merge FETCH_HEAD -m "Merge changes from upstream ${{ env.UPSTREAM_REPO }}/${{ env.TARGET_BRANCH }}"; then
echo "Conflicts detected. Staging conflicted files for the pull request." echo "Conflicts detected. Staging conflicted files for the pull request."
# Stage all changes, including conflicts # Stage all changes, including conflicts
git add -A git add -A
# Commit the merge with conflicts # Commit the merge with conflicts
git commit -m "Merge changes from upstream $UPSTREAM_REPO/$TARGET_BRANCH with conflicts" git commit -m "Merge changes from upstream ${{ env.UPSTREAM_REPO }}/${{ env.TARGET_BRANCH }} with conflicts"
fi fi
- name: Push changes to new branch - name: Push changes to new branch
if: success() if: success()
run: | run: |
git push origin "$BRANCH_NAME" git push origin "${{ env.BRANCH_NAME }}"
- name: Create Pull Request - name: Create Pull Request
if: success() if: success()
uses: peter-evans/create-pull-request@v4 uses: peter-evans/create-pull-request@v4
with: with:
token: ${{ steps.generate-rekku-token.outputs.token || secrets.GITHUB_TOKEN }} token: ${{ steps.generate-rekku-token.outputs.token || secrets.GITHUB_TOKEN }}
commit-message: "Sync with upstream changes from $UPSTREAM_REPO" commit-message: "Sync with upstream changes from ${{ env.UPSTREAM_REPO }}"
branch: ${{ env.BRANCH_NAME }} branch: ${{ env.BRANCH_NAME }}
title: "Sync with upstream $UPSTREAM_REPO" title: "Sync with upstream ${{ env.UPSTREAM_REPO }}"
body: | body: |
This PR merges the latest changes from the upstream repository: This PR merges the latest changes from the upstream repository:
- **Repository**: $UPSTREAM_REPO - **Repository**: ${{ env.UPSTREAM_REPO }}
- **Branch**: $TARGET_BRANCH - **Branch**: ${{ env.TARGET_BRANCH }}
## Conflict Resolution Instructions ## Conflict Resolution Instructions
If there are conflicts in this PR, you can resolve them locally by following these steps: If there are conflicts in this PR, you can resolve them locally by following these steps:
@ -95,7 +95,7 @@ jobs:
3. **Merge the upstream branch manually**: 3. **Merge the upstream branch manually**:
```bash ```bash
git fetch https://github.com/flathub/$UPSTREAM_REPO $TARGET_BRANCH git fetch https://github.com/flathub/${{ env.UPSTREAM_REPO }} ${{ env.TARGET_BRANCH }}
git merge FETCH_HEAD git merge FETCH_HEAD
``` ```
@ -114,4 +114,4 @@ jobs:
```bash ```bash
git push origin ${{ env.BRANCH_NAME }} git push origin ${{ env.BRANCH_NAME }}
``` ```
base: $TARGET_BRANCH base: ${{ env.TARGET_BRANCH }}