Merge pull request 'ci(merge_main): fix auth for self-hosted Gitea Actions' (#46) from hermes/brencher:fix/gitea-actions-merge-workflows into main
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/46
This commit was merged in pull request #46.
This commit is contained in:
@@ -20,16 +20,16 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
token: ${{ secrets.PUSH_TOKEN }}
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "GitHub Actions"
|
||||
git config user.email "gitea-actions[bot]@noreply.localhost"
|
||||
git config user.name "Gitea Actions"
|
||||
|
||||
- name: Fetch all branches
|
||||
run: |
|
||||
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
|
||||
git remote set-url origin "https://x-access-token:${PUSH_TOKEN}@${GITEA_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --all --prune
|
||||
|
||||
- name: Merge every branch onto main
|
||||
@@ -37,7 +37,6 @@ jobs:
|
||||
run: |
|
||||
set -eo pipefail
|
||||
MAIN=main
|
||||
# Collect remote branch names (exclude HEAD and main)
|
||||
branches=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin/ \
|
||||
| sed 's|^origin/||' \
|
||||
| grep -v -e '^HEAD$' -e '^main$' -e '^origin$' \
|
||||
@@ -49,11 +48,8 @@ jobs:
|
||||
continue
|
||||
fi
|
||||
echo "=== Processing branch: $br ==="
|
||||
# Create/update a local branch from remote
|
||||
git checkout -B "$br" "origin/$br"
|
||||
# Merge origin/main into branch (non-interactive)
|
||||
if git merge --no-edit "origin/$MAIN"; then
|
||||
# Push updated branch to remote (no force)
|
||||
if git push origin "$br"; then
|
||||
echo "Pushed merged $br"
|
||||
else
|
||||
|
||||
@@ -18,16 +18,16 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
token: ${{ secrets.PUSH_TOKEN }}
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "GitHub Actions"
|
||||
git config user.email "gitea-actions[bot]@noreply.localhost"
|
||||
git config user.name "Gitea Actions"
|
||||
|
||||
- name: Fetch all branches
|
||||
run: |
|
||||
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
|
||||
git remote set-url origin "https://x-access-token:${PUSH_TOKEN}@${GITEA_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --all --prune
|
||||
|
||||
- name: Merge every branch onto main
|
||||
@@ -35,7 +35,6 @@ jobs:
|
||||
run: |
|
||||
set -eo pipefail
|
||||
MAIN=main
|
||||
# Collect remote branch names (exclude HEAD and main)
|
||||
branches=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin/ \
|
||||
| sed 's|^origin/||' \
|
||||
| grep -v -e '^HEAD$' -e '^main$' -e '^origin$' \
|
||||
@@ -47,12 +46,9 @@ jobs:
|
||||
continue
|
||||
fi
|
||||
echo "=== Processing branch: $br ==="
|
||||
# Create/update a local branch from remote
|
||||
git reset --hard HEAD
|
||||
git checkout -B "$br" "origin/$br"
|
||||
# Merge origin/main into branch (non-interactive)
|
||||
if git merge --no-edit --squash "origin/$MAIN"; then
|
||||
# Push updated branch to remote (no force)
|
||||
git reset --soft "origin/$MAIN"
|
||||
git commit -m "Squash"
|
||||
if git push origin "$br" --force-with-lease; then
|
||||
|
||||
Reference in New Issue
Block a user