Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test change #18

Closed
wants to merge 85 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
59bdb3b
Add auto-update-pr workflow file
GitGab19 Aug 28, 2024
a87d118
Test change
GitGab19 Aug 28, 2024
a47a30b
Create update-prs.yaml
GitGab19 Aug 28, 2024
a235def
Update update-prs.yaml
GitGab19 Aug 28, 2024
6b4f925
Update update-prs.yaml
GitGab19 Aug 28, 2024
0c17f84
Update update-prs.yaml
GitGab19 Aug 28, 2024
9c375d9
Update update-prs.yaml
GitGab19 Aug 28, 2024
5132655
Update update-prs.yaml
GitGab19 Aug 28, 2024
e8621f2
Update update-prs.yaml
GitGab19 Aug 28, 2024
316a034
Update update-prs.yaml
GitGab19 Aug 28, 2024
53c1aa2
Update update-prs.yaml
GitGab19 Aug 28, 2024
4454fd3
Update update-prs.yaml
GitGab19 Aug 28, 2024
a4a5b74
Update update-prs.yaml
GitGab19 Aug 28, 2024
ac3a07d
Update update-prs.yaml
GitGab19 Aug 28, 2024
83f279e
Update update-prs.yaml
GitGab19 Aug 28, 2024
964dbf8
Update update-prs.yaml
GitGab19 Aug 28, 2024
5b2aca7
Update update-prs.yaml
GitGab19 Aug 28, 2024
9349690
Update and rename update-prs.yaml to autosquash.yaml
GitGab19 Aug 29, 2024
0f4ac0a
Add auto-update-pr workflow file
GitGab19 Aug 28, 2024
be4d4d4
Update RELEASE.md
GitGabPoliTo19 Aug 28, 2024
9551c76
Update autosquash.yaml
GitGab19 Aug 29, 2024
62e53ac
Update and rename autosquash.yaml to auto-update.yaml
GitGab19 Aug 29, 2024
787f504
Merge branch 'main' into main
GitGab19 Aug 29, 2024
69fd319
Merge pull request #21 from GitGabPoliTo19/main
GitGab19 Aug 29, 2024
9906d03
Delete .github/workflows/auto-update-pr.yaml
GitGab19 Aug 29, 2024
f912619
Update auto-update.yaml
GitGab19 Aug 29, 2024
35e8b86
Update auto-update.yaml
GitGab19 Aug 29, 2024
93d8d08
Update coverage.yaml
GitGab19 Aug 29, 2024
767c199
Update coverage.yaml
GitGab19 Aug 29, 2024
1055558
Create auto-rebase.yaml
GitGab19 Aug 29, 2024
530a044
Delete .github/workflows/auto-update.yaml
GitGab19 Aug 29, 2024
f0b7e6c
Delete .github/workflows/clippy-lint.yaml
GitGab19 Aug 29, 2024
6139bf0
Delete .github/workflows/coverage.yaml
GitGab19 Aug 29, 2024
797a099
Delete .github/workflows/lockfiles.yaml
GitGab19 Aug 29, 2024
a43d127
Delete .github/workflows/mg.yaml
GitGab19 Aug 29, 2024
1c47453
Delete .github/workflows/release-libs.yaml
GitGab19 Aug 29, 2024
bf60e52
Delete .github/workflows/run-and-track-benchmarks-on-main.yaml
GitGab19 Aug 29, 2024
d7a07a4
Delete .github/workflows/run-benchmarks.yaml
GitGab19 Aug 29, 2024
2ead55a
Delete .github/workflows/rust-msrv.yaml
GitGab19 Aug 29, 2024
b3cf6da
Delete .github/workflows/semver-check.yaml
GitGab19 Aug 29, 2024
55ea8a6
Delete .github/workflows/sv2-header-check.yaml
GitGab19 Aug 29, 2024
a0500a1
Delete .github/workflows/test.yaml
GitGab19 Aug 29, 2024
7b7f07e
Delete .github/workflows/track-benchmarks.yaml
GitGab19 Aug 29, 2024
781c418
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
a44116a
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
032868f
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
838e7d9
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
a01997d
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
de6f4d0
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
603bb16
Update README.md
GitGab19 Aug 29, 2024
4127c9a
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
994382d
Update README.md
GitGab19 Aug 29, 2024
46566bb
Create autorebase.yaml
GitGab19 Aug 29, 2024
7bf5d1a
Update README.md
GitGab19 Aug 29, 2024
21516f0
Update autorebase.yaml
GitGab19 Aug 29, 2024
9b301c3
Update README.md
GitGab19 Aug 29, 2024
25576fa
Update autorebase.yaml
GitGab19 Aug 29, 2024
8ecc6bf
Update autorebase.yaml
GitGab19 Aug 29, 2024
818bc89
Update autorebase.yaml
GitGab19 Aug 29, 2024
d61207d
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
6fd5c08
Update README.md
GitGab19 Aug 29, 2024
b5f89ce
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
c40a430
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
2fa22de
Create auto-rebase-with-github-token
GitGab19 Aug 29, 2024
e7ea0bb
Update auto-rebase-with-github-token
GitGab19 Aug 29, 2024
3433843
Rename auto-rebase-with-github-token to auto-rebase-with-github-token…
GitGab19 Aug 29, 2024
ae1383a
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
39f8996
Update README.md
GitGab19 Aug 29, 2024
109a1b9
Update auto-rebase-with-github-token.yaml
GitGab19 Aug 29, 2024
c298256
Update README.md
GitGab19 Aug 29, 2024
6390301
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
250e767
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
1885a22
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
20dfaa4
Update README.md
GitGab19 Aug 29, 2024
14bff9f
Update auto-rebase-with-github-token.yaml
GitGab19 Aug 29, 2024
1c64c76
Update README.md
GitGab19 Aug 29, 2024
6f3d561
Update fmt.yaml
GitGab19 Aug 29, 2024
ab6e660
Update fmt.yaml
GitGab19 Aug 29, 2024
626fa2b
Update README.md
GitGab19 Aug 29, 2024
00bedbd
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
bd745bb
Update auto-rebase-with-github-token.yaml
GitGab19 Aug 29, 2024
709b653
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
a29a520
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
e1c8c46
Update auto-rebase.yaml
GitGab19 Aug 29, 2024
9e1ad0a
Merge branch 'main' into test-pr
GitGab19 Aug 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/auto-rebase-with-github-token.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Auto Rebase wuth Github Token

on:
push:
branches:
- dev
workflow_dispatch:

jobs:
rebase:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub
fetch-depth: 0 # Fetch completo per avere tutta la cronologia

- name: Fetch open pull requests
run: |
gh auth setup-git
gh pr list --state open --json number,headRepositoryOwner,headRefName --jq '.[] | "\(.number) \(.headRepositoryOwner.login) \(.headRefName)"' > pr_details.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub

- name: Rebase pull requests
run: |
while read pr_number pr_owner pr_branch; do
echo "Processing PR #$pr_number"

# Add the contributor's fork as a remote
git remote add contributor https://github.com/$pr_owner/$(gh repo view --json name -q '.name').git

# Fetch the contributor's branches
git fetch contributor

# Checkout the branch from the contributor's fork
git checkout -b contributor-branch contributor/$pr_branch

# Set the committer name and email to match the PR author
PR_AUTHOR_NAME=$(gh pr view $pr_number --json author --jq '.author.login')
PR_AUTHOR_EMAIL="${PR_AUTHOR_NAME}@users.noreply.github.com"

git config user.name "$PR_AUTHOR_NAME"
git config user.email "$PR_AUTHOR_EMAIL"

# Rebase the branch on top of the main branch
git fetch origin main
git rebase origin/main || {
echo "Conflict detected. Aborting rebase and continuing."
git rebase --abort
continue
}

# Push the rebased branch back to the contributor's fork
git push --force-with-lease contributor contributor-branch:$pr_branch

# Remove the remote
git remote remove contributor

# Restart the check suite for the pull request
PR_HEAD_SHA=$(gh pr view $pr_number --json headRefOid --jq '.headRefOid')
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/check-suites/$PR_HEAD_SHA/rerequest
done < pr_details.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub
74 changes: 74 additions & 0 deletions .github/workflows/auto-rebase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Auto Rebase

on:
push:
branches:
- main
workflow_dispatch:

jobs:
rebase:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
persist-credentials: false
token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Use GitHub's default token
fetch-depth: 0 # Fetch full history to have the entire commit history

- name: Fetch open pull requests with label
run: |
gh auth setup-git
gh pr list --state open --label "ready-to-be-merged" --json number,headRepositoryOwner,headRefName --jq '.[] | "\(.number) \(.headRepositoryOwner.login) \(.headRefName)"' > pr_details.txt
env:
GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Use GitHub's default token

- name: Rebase pull requests
run: |
while read pr_number pr_owner pr_branch; do
echo "Processing PR #$pr_number"

# Add the contributor's fork as a remote
git remote add contributor https://github.com/$pr_owner/$(gh repo view --json name -q '.name').git

# Fetch the contributor's branches
git fetch contributor

# Create a unique branch name for this PR
unique_branch_name="contributor-branch-$pr_number"

# Checkout the branch from the contributor's fork
git checkout -b $unique_branch_name contributor/$pr_branch

# Set the committer name and email to match the PR author
PR_AUTHOR_NAME=$(gh pr view $pr_number --json author --jq '.author.login')
PR_AUTHOR_EMAIL="${PR_AUTHOR_NAME}@users.noreply.github.com"

git config user.name "$PR_AUTHOR_NAME"
git config user.email "$PR_AUTHOR_EMAIL"

# Rebase the branch on top of the main branch
git fetch origin main
git rebase origin/main || {
echo "Conflict detected. Aborting rebase and continuing."
git rebase --abort
continue
}

# Push the rebased branch back to the contributor's fork
git push --force-with-lease contributor $unique_branch_name:$pr_branch

# Remove the remote
git remote remove contributor

# Ensure we are not on the branch to be deleted
git checkout main

# Delete the local unique branch
git branch -D $unique_branch_name

done < pr_details.txt
env:
GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Use GitHub's default token
67 changes: 67 additions & 0 deletions .github/workflows/auto-update-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Auto Update Approved PRs with Conflict Handling

on:
push:
branches:
- main # Sostituisci con il tuo branch base se diverso
workflow_dispatch:

jobs:
update-pr:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # Necessario per operazioni di rebase

- name: Install GitHub CLI
uses: cli/cli-action@v2

- name: Fetch All Branches
run: git fetch --all

- name: Get List of Open PRs
id: get_open_prs
run: |
gh pr list --state open --json number,headRefName,baseRefName,isDraft,mergeable --jq '.[] | select(.baseRefName == "main" and .mergeable == "MERGEABLE") | .number' > pr_numbers.txt

- name: Check PR Reviews and Handle Conflicts
id: check_pr_reviews_and_conflicts
run: |
for pr in $(cat pr_numbers.txt); do
reviews=$(gh pr view $pr --json reviews --jq '.reviews[] | select(.state == "APPROVED")')
if [ -n "$reviews" ]; then
echo "PR #$pr has approved reviews."

# Check for conflicts during rebase
branch_name=$(gh pr view $pr --json headRefName --jq '.headRefName')
git checkout $branch_name
git fetch origin
git rebase origin/main
if [ $? -eq 0 ]; then
echo "PR #$pr rebase successful."
echo $pr >> approved_pr_numbers.txt
else
echo "PR #$pr has conflicts. Skipping rebase."
fi
else
echo "PR #$pr does not have approved reviews."
fi
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Rebase Approved PRs on Main
if: fileExists('approved_pr_numbers.txt')
run: |
while read -r pr; do
echo "Updating PR #$pr..."
branch_name=$(gh pr view $pr --json headRefName --jq '.headRefName')
git checkout $branch_name
git rebase origin/main
git push --force-with-lease
done < approved_pr_numbers.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/autorebase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Automatic Rebase
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
runs-on: ubuntu-latest
if: >-
github.event.issue.pull_request != '' &&
(
contains(github.event.comment.body, '/rebase') ||
contains(github.event.comment.body, '/autosquash')
)
steps:
- name: Checkout the latest code
uses: actions/checkout@v3
with:
#persist-credentials: false
token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo

- name: Configure git
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Automatic Rebase
uses: cirrus-actions/rebase@1.8
with:
autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }}
env:
GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }}
42 changes: 0 additions & 42 deletions .github/workflows/clippy-lint.yaml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/coverage.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/fmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
branches:
- main
- dev
workflow_run:
workflows: ["Auto Rebase wuth Github Token"] # Nome del workflow di rebase
types:
- completed

name: Rustfmt

Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/lockfiles.yaml

This file was deleted.

Loading
Loading