From 59bdb3bd847ec04c448c4915fb95fe0c23756558 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti Date: Wed, 28 Aug 2024 17:40:57 +0200 Subject: [PATCH 01/82] Add auto-update-pr workflow file --- .github/workflows/auto-update-pr.yaml | 67 +++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/auto-update-pr.yaml diff --git a/.github/workflows/auto-update-pr.yaml b/.github/workflows/auto-update-pr.yaml new file mode 100644 index 000000000..6486563de --- /dev/null +++ b/.github/workflows/auto-update-pr.yaml @@ -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 }} From a87d1180b9cf9f07e918776051faf20e92293ade Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti Date: Wed, 28 Aug 2024 17:45:27 +0200 Subject: [PATCH 02/82] Test change --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b1b2cd119..c951c1c82 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ +TEST PR


SRI From a47a30b19d17cf4c23bdc0960743c5e6a1babada Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 00:34:12 +0200 Subject: [PATCH 03/82] Create update-prs.yaml --- .github/workflows/update-prs.yaml | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/update-prs.yaml diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml new file mode 100644 index 000000000..75acc2830 --- /dev/null +++ b/.github/workflows/update-prs.yaml @@ -0,0 +1,40 @@ +name: Rebase Open PRs on Main Update + +on: + push: + branches: + - main + +jobs: + rebase: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Set up Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + - name: Get all open PRs + id: get_prs + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr list --state open --json number,headRefName,baseRefName,isDraft,mergeable --jq '.[] | select(.baseRefName == "main" and .mergeable == "MERGEABLE") | .number' > pr_numbers.txt + echo "List of PRs:" + cat pr_numbers.txt + + - name: Rebase each PR + run: | + for pr in $(cat pr_numbers.txt); do + echo "Rebasing PR #$pr" + git fetch origin pull/$pr/head:pr-$pr + git checkout pr-$pr + print=$(git remote -v) + echo $print + git rebase origin/main + git push origin pr-$pr -f + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a235def055367ef57b99dce55a71581c2e844132 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 00:39:21 +0200 Subject: [PATCH 04/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index 75acc2830..bb31dc4cb 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -29,6 +29,8 @@ jobs: run: | for pr in $(cat pr_numbers.txt); do echo "Rebasing PR #$pr" + print=$(git remote -v) + echo $print git fetch origin pull/$pr/head:pr-$pr git checkout pr-$pr print=$(git remote -v) From 6b4f9255a8cb05bc839b20392fc7b5c744b06fa5 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 00:45:35 +0200 Subject: [PATCH 05/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index bb31dc4cb..6b4f0a1ea 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -1,4 +1,4 @@ -name: Rebase Open PRs on Main Update +name: Rebase Ope PRs on Main Update on: push: From 0c17f84f644b3caf5dbbbd4aab3c399a8e9287f6 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:04:13 +0200 Subject: [PATCH 06/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 85 ++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 18 deletions(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index 6b4f0a1ea..055c82360 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -1,42 +1,91 @@ -name: Rebase Ope PRs on Main Update +name: Auto Update Approved PRs with Conflict Handling on: push: branches: - - main + - main # Sostituisci con il tuo branch base se diverso + workflow_dispatch: jobs: - rebase: + update-pr: runs-on: ubuntu-latest + steps: - - name: Check out repository + - name: Sleep for 10 seconds + run: sleep 10 + + - name: Checkout Repository uses: actions/checkout@v2 + with: + fetch-depth: 0 # Necessario per operazioni di rebase - - name: Set up Git + - name: Set up Git configuration run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - - name: Get all open PRs - id: get_prs + + - name: Fetch All Branches + run: git fetch --all + + - name: Get List of Open PRs + id: get_open_prs env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh pr list --state open --json number,headRefName,baseRefName,isDraft,mergeable --jq '.[] | select(.baseRefName == "main" and .mergeable == "MERGEABLE") | .number' > pr_numbers.txt echo "List of PRs:" cat pr_numbers.txt - - - name: Rebase each PR + + - name: Check PR Reviews and Handle Conflicts + id: check_pr_reviews_and_conflicts + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + approved_pr_count=0 + touch approved_pr_numbers.txt for pr in $(cat pr_numbers.txt); do - echo "Rebasing PR #$pr" - print=$(git remote -v) - echo $print - git fetch origin pull/$pr/head:pr-$pr - git checkout pr-$pr - print=$(git remote -v) - echo $print - git rebase origin/main - git push origin pr-$pr -f + echo "Checking PR #$pr..." + reviews=$(gh pr view $pr --json reviews --jq '.reviews[] | select(.state == "APPROVED")') + echo "Reviews for PR #$pr: $reviews" + if [ -n "$reviews" ]; then + echo "PR #$pr has approved reviews." + echo $pr >> approved_pr_numbers.txt + approved_pr_count=$((approved_pr_count + 1)) + else + echo "PR #$pr does not have approved reviews." + fi done + echo "Approved PR count: $approved_pr_count" + echo "APPROVED_PR_COUNT=$approved_pr_count" >> $GITHUB_ENV + + - name: Rebase Approved PRs on Main + if: env.APPROVED_PR_COUNT != '0' + run: | + echo "Approved PRs to be rebased:" + cat approved_pr_numbers.txt + while read -r pr; do + echo "Updating PR #$pr..." + + # Fetch PR branch and checkout + git fetch origin pull/$pr/head:pr-$pr + git checkout -b pr-$pr FETCH_HEAD + + # Rebase and push changes + git fetch origin main + git rebase origin/main || ( + echo "Rebase failed. Resolving conflicts..." + git rebase --abort + exit 1 + ) + + # Force push the rebased PR branch + git push --force-with-lease origin pr-$pr + + echo "Successfully rebased and pushed PR #$pr" + done < approved_pr_numbers.txt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Complete Workflow + if: always() + run: echo "PR update process completed." From 9c375d91e3522416c36632f6806f9a63f183fbb5 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:09:25 +0200 Subject: [PATCH 07/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index 055c82360..23312500a 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -1,4 +1,4 @@ -name: Auto Update Approved PRs with Conflict Handling +name: Auto Update Approved PRs with Conflicts Handling on: push: From 5132655c6f24109c104a108de58bbb13305ac6d9 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:12:17 +0200 Subject: [PATCH 08/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index 23312500a..b5f705a7c 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -67,8 +67,8 @@ jobs: echo "Updating PR #$pr..." # Fetch PR branch and checkout - git fetch origin pull/$pr/head:pr-$pr - git checkout -b pr-$pr FETCH_HEAD + git fetch origin pull/$pr/head:pr-number-$pr + git checkout -b pr-number-$pr FETCH_HEAD # Rebase and push changes git fetch origin main From e8621f2eacd16bc8a9cf2902c0959d26c7be54c9 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:14:51 +0200 Subject: [PATCH 09/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index b5f705a7c..a5bd2c172 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -67,8 +67,8 @@ jobs: echo "Updating PR #$pr..." # Fetch PR branch and checkout - git fetch origin pull/$pr/head:pr-number-$pr - git checkout -b pr-number-$pr FETCH_HEAD + git fetch origin pull/$pr/head:pr-$pr + git checkout pr-$pr FETCH_HEAD # Rebase and push changes git fetch origin main From 316a034b1f7007dadd00d1c52e9fb8549d9de55a Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:19:15 +0200 Subject: [PATCH 10/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index a5bd2c172..0c9adbffb 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -1,4 +1,4 @@ -name: Auto Update Approved PRs with Conflicts Handling +name: Auto Update Approved PRs with Conflict Handling on: push: @@ -65,26 +65,33 @@ jobs: cat approved_pr_numbers.txt while read -r pr; do echo "Updating PR #$pr..." - - # Fetch PR branch and checkout - git fetch origin pull/$pr/head:pr-$pr - git checkout pr-$pr FETCH_HEAD - # Rebase and push changes + # Aggiungi il remote del fork del contributore + fork_url=$(gh pr view $pr --json repository --jq '.repository.url') + git remote add contributor-fork ${fork_url}.git + + # Recupera i dati del fork + git fetch contributor-fork + + # Checkout del branch della PR + pr_branch=$(gh pr view $pr --json headRefName --jq '.headRefName') + git checkout -b pr-$pr contributor-fork/$pr_branch + + # Rebase e push git fetch origin main git rebase origin/main || ( echo "Rebase failed. Resolving conflicts..." git rebase --abort exit 1 ) - - # Force push the rebased PR branch - git push --force-with-lease origin pr-$pr + + # Push forzato del branch rebased verso il fork del contributore + git push --force-with-lease contributor-fork pr-$pr echo "Successfully rebased and pushed PR #$pr" done < approved_pr_numbers.txt env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Complete Workflow if: always() From 53c1aa2c8ab1766ce33196f9a85955759440a4d8 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:22:17 +0200 Subject: [PATCH 11/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index 0c9adbffb..fa06bb4ab 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -11,8 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Sleep for 10 seconds - run: sleep 10 - name: Checkout Repository uses: actions/checkout@v2 @@ -67,7 +65,7 @@ jobs: echo "Updating PR #$pr..." # Aggiungi il remote del fork del contributore - fork_url=$(gh pr view $pr --json repository --jq '.repository.url') + fork_url=$(gh pr view $pr --json headRepository --jq '.headRepository.url') git remote add contributor-fork ${fork_url}.git # Recupera i dati del fork @@ -91,7 +89,7 @@ jobs: echo "Successfully rebased and pushed PR #$pr" done < approved_pr_numbers.txt env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Complete Workflow if: always() From 4454fd3ac06010f939c86e016e1dd73e112ef219 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:27:03 +0200 Subject: [PATCH 12/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index fa06bb4ab..a51723fa1 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -66,6 +66,7 @@ jobs: # Aggiungi il remote del fork del contributore fork_url=$(gh pr view $pr --json headRepository --jq '.headRepository.url') + echo $fork_url git remote add contributor-fork ${fork_url}.git # Recupera i dati del fork @@ -84,7 +85,7 @@ jobs: ) # Push forzato del branch rebased verso il fork del contributore - git push --force-with-lease contributor-fork pr-$pr + git push contributor-fork pr-$pr --force echo "Successfully rebased and pushed PR #$pr" done < approved_pr_numbers.txt From a4a5b7415cb88c5022297ec9c21146e6c208f753 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:30:00 +0200 Subject: [PATCH 13/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index a51723fa1..48955fdc4 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -65,6 +65,8 @@ jobs: echo "Updating PR #$pr..." # Aggiungi il remote del fork del contributore + print=$(gh pr view $pr --json) + echo $print fork_url=$(gh pr view $pr --json headRepository --jq '.headRepository.url') echo $fork_url git remote add contributor-fork ${fork_url}.git From ac3a07dd4b91d27e7908ef9d8006cc68d5966f10 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:32:10 +0200 Subject: [PATCH 14/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index 48955fdc4..1165f5dd8 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -65,7 +65,7 @@ jobs: echo "Updating PR #$pr..." # Aggiungi il remote del fork del contributore - print=$(gh pr view $pr --json) + print=$(gh pr view $pr --json url) echo $print fork_url=$(gh pr view $pr --json headRepository --jq '.headRepository.url') echo $fork_url From 83f279ec61af9879e88990109a5867d70aef48db Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:37:45 +0200 Subject: [PATCH 15/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index 1165f5dd8..b772f3d94 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -65,7 +65,7 @@ jobs: echo "Updating PR #$pr..." # Aggiungi il remote del fork del contributore - print=$(gh pr view $pr --json url) + print=$(gh pr view $pr --json headRepository) echo $print fork_url=$(gh pr view $pr --json headRepository --jq '.headRepository.url') echo $fork_url From 964dbf8859c3241ea0bf4150048e951cf9de7289 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:39:49 +0200 Subject: [PATCH 16/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index b772f3d94..7a1443931 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -65,7 +65,7 @@ jobs: echo "Updating PR #$pr..." # Aggiungi il remote del fork del contributore - print=$(gh pr view $pr --json headRepository) + print=$(gh pr view --json additions,assignees,author,autoMergeRequest,baseRefName,body,changedFiles,closed,closedAt,comments,commits,createdAt,deletions,files,fullDatabaseId,headRefName,headRefOid,headRepository,headRepositoryOwner,id,isCrossRepository,isDraft,labels,latestReviews,maintainerCanModify,mergeCommit,mergeStateStatus,mergeable,mergedAt,mergedBy,milestone,number,potentialMergeCommit,projectCards,projectItems,reactionGroups,reviewDecision,reviewRequests,reviews,state,statusCheckRollup,title,updatedAt,url) echo $print fork_url=$(gh pr view $pr --json headRepository --jq '.headRepository.url') echo $fork_url From 5b2aca7e1673765e52099f4f0b0326a66f5f29b5 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:41:58 +0200 Subject: [PATCH 17/82] Update update-prs.yaml --- .github/workflows/update-prs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml index 7a1443931..6469158c9 100644 --- a/.github/workflows/update-prs.yaml +++ b/.github/workflows/update-prs.yaml @@ -65,7 +65,7 @@ jobs: echo "Updating PR #$pr..." # Aggiungi il remote del fork del contributore - print=$(gh pr view --json additions,assignees,author,autoMergeRequest,baseRefName,body,changedFiles,closed,closedAt,comments,commits,createdAt,deletions,files,fullDatabaseId,headRefName,headRefOid,headRepository,headRepositoryOwner,id,isCrossRepository,isDraft,labels,latestReviews,maintainerCanModify,mergeCommit,mergeStateStatus,mergeable,mergedAt,mergedBy,milestone,number,potentialMergeCommit,projectCards,projectItems,reactionGroups,reviewDecision,reviewRequests,reviews,state,statusCheckRollup,title,updatedAt,url) + print=$(gh pr view $pr --json additions,assignees,author,autoMergeRequest,baseRefName,body,changedFiles,closed,closedAt,comments,commits,createdAt,deletions,files,fullDatabaseId,headRefName,headRefOid,headRepository,headRepositoryOwner,id,isCrossRepository,isDraft,labels,latestReviews,maintainerCanModify,mergeCommit,mergeStateStatus,mergeable,mergedAt,mergedBy,milestone,number,potentialMergeCommit,projectCards,projectItems,reactionGroups,reviewDecision,reviewRequests,reviews,state,statusCheckRollup,title,updatedAt,url) echo $print fork_url=$(gh pr view $pr --json headRepository --jq '.headRepository.url') echo $fork_url From 93496906ff9da70d0fc340f7e1aab2bb3cec0037 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 02:15:05 +0200 Subject: [PATCH 18/82] Update and rename update-prs.yaml to autosquash.yaml --- .github/workflows/autosquash.yaml | 34 +++++++++++ .github/workflows/update-prs.yaml | 99 ------------------------------- 2 files changed, 34 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/autosquash.yaml delete mode 100644 .github/workflows/update-prs.yaml diff --git a/.github/workflows/autosquash.yaml b/.github/workflows/autosquash.yaml new file mode 100644 index 000000000..926d17531 --- /dev/null +++ b/.github/workflows/autosquash.yaml @@ -0,0 +1,34 @@ +name: Autosquash +on: + check_run: + types: + # Check runs completing successfully can unblock the corresponding pull requests and make them mergeable. + - completed + pull_request: + types: + # A closed pull request makes the checks on the other pull request on the same base outdated. + - closed + # Adding the autosquash label to a pull request can trigger an update or a merge. + - labeled + pull_request_review: + types: + # Review approvals can unblock the pull request and make it mergeable. + - submitted + # Success statuses can unblock the corresponding pull requests and make them mergeable. + status: {} + +jobs: + autosquash: + name: Autosquash + runs-on: ubuntu-18.04 + steps: + - uses: tibdex/autosquash@v2 + with: + # The built-in secrets.GITHUB_TOKEN cannot yet be used because of this limitation: + # https://github.community/t5/GitHub-Actions/Triggering-a-new-workflow-from-another-workflow/td-p/31676 + # In the meantime, use a token granting write access on the repo: + # - a GitHub App token + # See https://github.com/marketplace/actions/github-app-token. + # - a personal access token + # See https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line. + github_token: ${{ secrets.AUTOSQUASH_TOKEN }} diff --git a/.github/workflows/update-prs.yaml b/.github/workflows/update-prs.yaml deleted file mode 100644 index 6469158c9..000000000 --- a/.github/workflows/update-prs.yaml +++ /dev/null @@ -1,99 +0,0 @@ -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: Set up Git configuration - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - - name: Fetch All Branches - run: git fetch --all - - - name: Get List of Open PRs - id: get_open_prs - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh pr list --state open --json number,headRefName,baseRefName,isDraft,mergeable --jq '.[] | select(.baseRefName == "main" and .mergeable == "MERGEABLE") | .number' > pr_numbers.txt - echo "List of PRs:" - cat pr_numbers.txt - - - name: Check PR Reviews and Handle Conflicts - id: check_pr_reviews_and_conflicts - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - approved_pr_count=0 - touch approved_pr_numbers.txt - for pr in $(cat pr_numbers.txt); do - echo "Checking PR #$pr..." - reviews=$(gh pr view $pr --json reviews --jq '.reviews[] | select(.state == "APPROVED")') - echo "Reviews for PR #$pr: $reviews" - if [ -n "$reviews" ]; then - echo "PR #$pr has approved reviews." - echo $pr >> approved_pr_numbers.txt - approved_pr_count=$((approved_pr_count + 1)) - else - echo "PR #$pr does not have approved reviews." - fi - done - echo "Approved PR count: $approved_pr_count" - echo "APPROVED_PR_COUNT=$approved_pr_count" >> $GITHUB_ENV - - - name: Rebase Approved PRs on Main - if: env.APPROVED_PR_COUNT != '0' - run: | - echo "Approved PRs to be rebased:" - cat approved_pr_numbers.txt - while read -r pr; do - echo "Updating PR #$pr..." - - # Aggiungi il remote del fork del contributore - print=$(gh pr view $pr --json additions,assignees,author,autoMergeRequest,baseRefName,body,changedFiles,closed,closedAt,comments,commits,createdAt,deletions,files,fullDatabaseId,headRefName,headRefOid,headRepository,headRepositoryOwner,id,isCrossRepository,isDraft,labels,latestReviews,maintainerCanModify,mergeCommit,mergeStateStatus,mergeable,mergedAt,mergedBy,milestone,number,potentialMergeCommit,projectCards,projectItems,reactionGroups,reviewDecision,reviewRequests,reviews,state,statusCheckRollup,title,updatedAt,url) - echo $print - fork_url=$(gh pr view $pr --json headRepository --jq '.headRepository.url') - echo $fork_url - git remote add contributor-fork ${fork_url}.git - - # Recupera i dati del fork - git fetch contributor-fork - - # Checkout del branch della PR - pr_branch=$(gh pr view $pr --json headRefName --jq '.headRefName') - git checkout -b pr-$pr contributor-fork/$pr_branch - - # Rebase e push - git fetch origin main - git rebase origin/main || ( - echo "Rebase failed. Resolving conflicts..." - git rebase --abort - exit 1 - ) - - # Push forzato del branch rebased verso il fork del contributore - git push contributor-fork pr-$pr --force - - echo "Successfully rebased and pushed PR #$pr" - done < approved_pr_numbers.txt - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Complete Workflow - if: always() - run: echo "PR update process completed." From 0f4ac0a167376caaadad2894a6456beea28e5769 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti Date: Wed, 28 Aug 2024 17:40:57 +0200 Subject: [PATCH 19/82] Add auto-update-pr workflow file --- .github/workflows/auto-update-pr.yaml | 67 +++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/auto-update-pr.yaml diff --git a/.github/workflows/auto-update-pr.yaml b/.github/workflows/auto-update-pr.yaml new file mode 100644 index 000000000..6486563de --- /dev/null +++ b/.github/workflows/auto-update-pr.yaml @@ -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 }} From be4d4d4dae3d59caaddb0f5b2fc2ce24d69a416d Mon Sep 17 00:00:00 2001 From: GitGabPoliTo19 <80284337+GitGabPoliTo19@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:50:28 +0200 Subject: [PATCH 20/82] Update RELEASE.md --- RELEASE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE.md b/RELEASE.md index 754d55edf..a0d6e4c57 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,4 @@ +TEST ## Changelog The changelog is a file that contains a curated, chronologically ordered list of From 9551c7611595309d4d45bb4f53f5770541280ade Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 02:24:02 +0200 Subject: [PATCH 21/82] Update autosquash.yaml --- .github/workflows/autosquash.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autosquash.yaml b/.github/workflows/autosquash.yaml index 926d17531..167348260 100644 --- a/.github/workflows/autosquash.yaml +++ b/.github/workflows/autosquash.yaml @@ -1,4 +1,4 @@ -name: Autosquash +name: Autosquash (merge and squash) on: check_run: types: From 62e53acb7ddaa48daf302d17c0553139ce476290 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 11:57:01 +0200 Subject: [PATCH 22/82] Update and rename autosquash.yaml to auto-update.yaml --- .github/workflows/auto-update.yaml | 16 ++++++++++++++ .github/workflows/autosquash.yaml | 34 ------------------------------ 2 files changed, 16 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/auto-update.yaml delete mode 100644 .github/workflows/autosquash.yaml diff --git a/.github/workflows/auto-update.yaml b/.github/workflows/auto-update.yaml new file mode 100644 index 000000000..ed361de06 --- /dev/null +++ b/.github/workflows/auto-update.yaml @@ -0,0 +1,16 @@ +name: Auto-update +# Auto-update only listens to `push` events. +# If a pull request is already outdated when enabling auto-merge, manually click on the "Update branch" button a first time to avoid having to wait for another commit to land on the base branch for the pull request to be updated. +# on: push +# If pull requests are always based on the same branches, only triggering the workflow when these branches receive new commits will minimize the workflow execution. +on: + push: + branches: + - main + +jobs: + Auto: + name: Auto-update + runs-on: ubuntu-latest + steps: + - uses: tibdex/auto-update@v2 diff --git a/.github/workflows/autosquash.yaml b/.github/workflows/autosquash.yaml deleted file mode 100644 index 167348260..000000000 --- a/.github/workflows/autosquash.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: Autosquash (merge and squash) -on: - check_run: - types: - # Check runs completing successfully can unblock the corresponding pull requests and make them mergeable. - - completed - pull_request: - types: - # A closed pull request makes the checks on the other pull request on the same base outdated. - - closed - # Adding the autosquash label to a pull request can trigger an update or a merge. - - labeled - pull_request_review: - types: - # Review approvals can unblock the pull request and make it mergeable. - - submitted - # Success statuses can unblock the corresponding pull requests and make them mergeable. - status: {} - -jobs: - autosquash: - name: Autosquash - runs-on: ubuntu-18.04 - steps: - - uses: tibdex/autosquash@v2 - with: - # The built-in secrets.GITHUB_TOKEN cannot yet be used because of this limitation: - # https://github.community/t5/GitHub-Actions/Triggering-a-new-workflow-from-another-workflow/td-p/31676 - # In the meantime, use a token granting write access on the repo: - # - a GitHub App token - # See https://github.com/marketplace/actions/github-app-token. - # - a personal access token - # See https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line. - github_token: ${{ secrets.AUTOSQUASH_TOKEN }} From 9906d03fd523a3ecfdf39fec28e0a72c96ef9d6b Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:13:46 +0200 Subject: [PATCH 23/82] Delete .github/workflows/auto-update-pr.yaml --- .github/workflows/auto-update-pr.yaml | 67 --------------------------- 1 file changed, 67 deletions(-) delete mode 100644 .github/workflows/auto-update-pr.yaml diff --git a/.github/workflows/auto-update-pr.yaml b/.github/workflows/auto-update-pr.yaml deleted file mode 100644 index 6486563de..000000000 --- a/.github/workflows/auto-update-pr.yaml +++ /dev/null @@ -1,67 +0,0 @@ -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 }} From f91261937da9d2b3da5ec8d4c9d5b547aa9a4d92 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:26:13 +0200 Subject: [PATCH 24/82] Update auto-update.yaml --- .github/workflows/auto-update.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/auto-update.yaml b/.github/workflows/auto-update.yaml index ed361de06..522692ac4 100644 --- a/.github/workflows/auto-update.yaml +++ b/.github/workflows/auto-update.yaml @@ -1,5 +1,4 @@ name: Auto-update -# Auto-update only listens to `push` events. # If a pull request is already outdated when enabling auto-merge, manually click on the "Update branch" button a first time to avoid having to wait for another commit to land on the base branch for the pull request to be updated. # on: push # If pull requests are always based on the same branches, only triggering the workflow when these branches receive new commits will minimize the workflow execution. From 35e8b8677edda5e85e8a8220dea20053ee77bab0 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:35:45 +0200 Subject: [PATCH 25/82] Update auto-update.yaml --- .github/workflows/auto-update.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-update.yaml b/.github/workflows/auto-update.yaml index 522692ac4..ed361de06 100644 --- a/.github/workflows/auto-update.yaml +++ b/.github/workflows/auto-update.yaml @@ -1,4 +1,5 @@ name: Auto-update +# Auto-update only listens to `push` events. # If a pull request is already outdated when enabling auto-merge, manually click on the "Update branch" button a first time to avoid having to wait for another commit to land on the base branch for the pull request to be updated. # on: push # If pull requests are always based on the same branches, only triggering the workflow when these branches receive new commits will minimize the workflow execution. From 93d8d080799f3db19afc2b4dd775d586553a5f98 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:55:12 +0200 Subject: [PATCH 26/82] Update coverage.yaml --- .github/workflows/coverage.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 5c20325c1..561e23738 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -14,6 +14,7 @@ # This test loops through every test in test/message-generator/test, and runs each one, collecting # code coverage data for anything in the roles/ directory that is relevant to SV2(pool, mining-proxy) + name: Test Coverage on: From 767c199fca59e2f43be1ede4136bf174f4b15aac Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:01:24 +0200 Subject: [PATCH 27/82] Update coverage.yaml --- .github/workflows/coverage.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 561e23738..5c20325c1 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -14,7 +14,6 @@ # This test loops through every test in test/message-generator/test, and runs each one, collecting # code coverage data for anything in the roles/ directory that is relevant to SV2(pool, mining-proxy) - name: Test Coverage on: From 10555587dba075aa1d7d5d813c469a56f7ba13ab Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:59:18 +0200 Subject: [PATCH 28/82] Create auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/auto-rebase.yaml diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml new file mode 100644 index 000000000..42d9ba076 --- /dev/null +++ b/.github/workflows/auto-rebase.yaml @@ -0,0 +1,37 @@ +name: Auto Rebase + +on: + push: + branches: + - main # Ogni volta che viene fatto un push sul branch `main`, la action viene eseguita. + workflow_dispatch: # Permette di eseguire manualmente la action dal tab Actions su GitHub. + +jobs: + rebase: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up GitHub CLI + uses: actions/setup-gh@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Fetch open pull requests + id: fetch_prs + run: | + gh pr list --state open --json number --jq '.[].number' > pr_numbers.txt + + - name: Rebase pull requests + run: | + while read pr; do + echo "Rebasing PR #$pr" + gh pr checkout $pr + git fetch origin main + git rebase origin/main + git push --force-with-lease + done < pr_numbers.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 530a04419ab14e189f9d8724e03296fa0f44cdb5 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:00:53 +0200 Subject: [PATCH 29/82] Delete .github/workflows/auto-update.yaml --- .github/workflows/auto-update.yaml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/workflows/auto-update.yaml diff --git a/.github/workflows/auto-update.yaml b/.github/workflows/auto-update.yaml deleted file mode 100644 index ed361de06..000000000 --- a/.github/workflows/auto-update.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: Auto-update -# Auto-update only listens to `push` events. -# If a pull request is already outdated when enabling auto-merge, manually click on the "Update branch" button a first time to avoid having to wait for another commit to land on the base branch for the pull request to be updated. -# on: push -# If pull requests are always based on the same branches, only triggering the workflow when these branches receive new commits will minimize the workflow execution. -on: - push: - branches: - - main - -jobs: - Auto: - name: Auto-update - runs-on: ubuntu-latest - steps: - - uses: tibdex/auto-update@v2 From f0b7e6cae9e20e9b38eafba7b1a04b11ed90bc60 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:01:05 +0200 Subject: [PATCH 30/82] Delete .github/workflows/clippy-lint.yaml --- .github/workflows/clippy-lint.yaml | 42 ------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 .github/workflows/clippy-lint.yaml diff --git a/.github/workflows/clippy-lint.yaml b/.github/workflows/clippy-lint.yaml deleted file mode 100644 index fa2c45fac..000000000 --- a/.github/workflows/clippy-lint.yaml +++ /dev/null @@ -1,42 +0,0 @@ -on: - push: - branches: - - main - - dev - pull_request: - branches: - - main - - dev - -name: Clippy Lint - -jobs: - clippy-check: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - macos-latest - - ubuntu-latest - include: - - os: macos-latest - target: x86_64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - - steps: - - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - components: clippy - - name: Run Clippy on different workspaces and crates - run: | - cargo clippy --manifest-path=benches/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=common/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=protocols/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=roles/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=utils/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=utils/message-generator/Cargo.toml -- -D warnings -A dead-code From 6139bf01d9ff10002d1da0870858b6dbba952816 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:01:17 +0200 Subject: [PATCH 31/82] Delete .github/workflows/coverage.yaml --- .github/workflows/coverage.yaml | 48 --------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 .github/workflows/coverage.yaml diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml deleted file mode 100644 index 5c20325c1..000000000 --- a/.github/workflows/coverage.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# Performs test coverage of project's libraries using cargo-tarpaulin and generates results using codecov.io. -# The following flags are set inside `tarpaulin.toml`: -# `features = "..."`: Includes the code with the listed features. The following features result in a -# tarpaulin error and are NOT included: derive, alloc, arbitrary-derive, attributes, and -# with_serde -# `run-types = [ "Lib" ]`: Only tests the package's library unit tests. Includes protocols, and utils (without the -# exclude-files flag, it includes this example because it contains a lib.rs file) -# `exclude-files = [ "examples/*" ]`: Excludes all projects in examples directory (specifically added to -# ignore examples that that contain a lib.rs file like interop-cpp) -# `timeout = "120s"`: If unresponsive for 120 seconds, action will fail -# `fail-under = 20`: If code coverage is less than 20%, action will fail -# `out = ["Xml"]`: Required for codecov.io to generate coverage result -# All message-generator test flags are in tests in test/message-generator/test -# This test loops through every test in test/message-generator/test, and runs each one, collecting -# code coverage data for anything in the roles/ directory that is relevant to SV2(pool, mining-proxy) - -name: Test Coverage - -on: - push: - branches: [ main, dev ] - pull_request: - branches: [ main, dev ] - -jobs: - tarpaulin-test: - - name: Tarpaulin Test - runs-on: ubuntu-latest - container: - image: xd009642/tarpaulin:0.27.1-nightly - options: --security-opt seccomp=unconfined - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Generate code coverage - run: | - ./scripts/tarpaulin.sh - - - name: Archive Tarpaulin code coverage results - uses: actions/upload-artifact@v4 - with: - name: tarpaulin-report - path: | - protocols/cobertura.xml - roles/cobertura.xml - utils/cobertura.xml From 797a0995aaf16d9fe2c8f241cee5cfbb73b93354 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:01:27 +0200 Subject: [PATCH 32/82] Delete .github/workflows/lockfiles.yaml --- .github/workflows/lockfiles.yaml | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .github/workflows/lockfiles.yaml diff --git a/.github/workflows/lockfiles.yaml b/.github/workflows/lockfiles.yaml deleted file mode 100644 index e87f016a7..000000000 --- a/.github/workflows/lockfiles.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Lockfiles - -# Trigger the workflow on push or pull request events for the dev and main branches -on: - push: - branches: - - dev - - main - pull_request: - branches: - - dev - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Build with locked dependencies - run: | - cargo build --manifest-path=roles/Cargo.toml --locked - cargo build --manifest-path=utils/Cargo.toml --locked \ No newline at end of file From a43d127d62d5e5326d2e60ce8dfdc1ace6c578ce Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:01:38 +0200 Subject: [PATCH 33/82] Delete .github/workflows/mg.yaml --- .github/workflows/mg.yaml | 221 -------------------------------------- 1 file changed, 221 deletions(-) delete mode 100644 .github/workflows/mg.yaml diff --git a/.github/workflows/mg.yaml b/.github/workflows/mg.yaml deleted file mode 100644 index 8ee27a9c3..000000000 --- a/.github/workflows/mg.yaml +++ /dev/null @@ -1,221 +0,0 @@ -# Runs all Message Generator tests in separate jobs - -name: MG Test - -on: - push: - branches: [ main, dev ] - pull_request: - branches: [ main, dev ] - -jobs: - bad-pool-config-test: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run bad-pool-config-test - run: sh ./test/message-generator/test/bad-pool-config-test/bad-pool-config-test.sh - - interop-jd-translator: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run interop-jd-translator - run: sh ./test/message-generator/test/interop-jd-translator/interop-jd-translator.sh - - interop-proxy-with-multi-ups: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run interop-proxy-with-multi-ups - run: sh ./test/message-generator/test/interop-proxy-with-multi-ups/interop-proxy-with-multi-ups.sh - - interop-proxy-with-multi-ups-extended: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run interop-proxy-with-multi-ups-extended - run: sh ./test/message-generator/test/interop-proxy-with-multi-ups-extended/interop-proxy-with-multi-ups-extended.sh - - jds-do-not-fail-on-wrong-tsdatasucc: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run jds-do-not-fail-on-wrong-tsdatasucc - run: sh ./test/message-generator/test/jds-do-not-fail-on-wrong-tsdatasucc/jds-do-not-fail-on-wrong-tsdatasucc.sh - - jds-do-not-panic-if-jdc-close-connection: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run jds-do-not-panic-if-jdc-close-connection - run: sh ./test/message-generator/test/jds-do-not-panic-if-jdc-close-connection/jds-do-not-panic-if-jdc-close-connection.sh - - jds-do-not-stackoverflow-when-no-token: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run jds-do-not-stackoverflow-when-no-token - run: sh ./test/message-generator/test/jds-do-not-stackoverflow-when-no-token/jds-do-not-stackoverflow-when-no-token.sh - - jds-receive-solution-while-processing-declared-job: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run jds-receive-solution-while-processing-declared-job - run: sh ./test/message-generator/test/jds-receive-solution-while-processing-declared-job/jds-receive-solution-while-processing-declared-job.sh - - pool-sri-test-1-standard: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run pool-sri-test-1-standard - run: sh ./test/message-generator/test/pool-sri-test-1-standard/pool-sri-test-1-standard.sh - - pool-sri-test-close-channel: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run pool-sri-test-close-channel - run: sh ./test/message-generator/test/pool-sri-test-close-channel/pool-sri-test-close-channel.sh - - pool-sri-test-extended_0: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run pool-sri-test-extended_0 - run: sh ./test/message-generator/test/pool-sri-test-extended_0/pool-sri-test-extended_0.sh - - pool-sri-test-extended_1: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run pool-sri-test-extended_1 - run: sh ./test/message-generator/test/pool-sri-test-extended_1/pool-sri-test-extended_1.sh - - pool-sri-test-reject-auth: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run pool-sri-test-reject-auth - run: sh ./test/message-generator/test/pool-sri-test-reject-auth/pool-sri-test-reject-auth.sh - - standard-coverage: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run standard-coverage - run: sh ./test/message-generator/test/standard-coverage-test/standard-coverage-test.sh - - sv1-test: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run sv1-test - run: sh ./test/message-generator/test/sv1-test/sv1-test.sh - - translation-proxy-broke-pool: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run translation-proxy-broke-pool - run: sh ./test/message-generator/test/translation-proxy-broke-pool/translation-proxy-broke-pool.sh - - translation-proxy: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run translation-proxy - run: sh ./test/message-generator/test/translation-proxy/translation-proxy.sh - - translation-proxy-old-share: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run translation-proxy-old-share - run: sh ./test/message-generator/test/translation-proxy-old-share/translation-proxy-old-share.sh - - mg-aggregate-results: - name: "Aggregate MG Test Results" - runs-on: ubuntu-latest - if: always() - needs: [ - bad-pool-config-test, - interop-jd-translator, - interop-proxy-with-multi-ups, - interop-proxy-with-multi-ups-extended, - jds-do-not-fail-on-wrong-tsdatasucc, - jds-do-not-panic-if-jdc-close-connection, - jds-do-not-stackoverflow-when-no-token, - jds-receive-solution-while-processing-declared-job, - pool-sri-test-1-standard, - pool-sri-test-close-channel, - pool-sri-test-extended_0, - pool-sri-test-extended_1, - pool-sri-test-reject-auth, - standard-coverage, - sv1-test, - translation-proxy-broke-pool, - translation-proxy, - translation-proxy-old-share - ] - steps: - - name: Aggregate Results - run: | - if [ "${{ needs.bad-pool-config-test.result }}" != "success" ] || - [ "${{ needs.interop-jd-translator.result }}" != "success" ] || - [ "${{ needs.interop-proxy-with-multi-ups.result }}" != "success" ] || - [ "${{ needs.interop-proxy-with-multi-ups-extended.result }}" != "success" ] || - [ "${{ needs.jds-do-not-fail-on-wrong-tsdatasucc.result }}" != "success" ] || - [ "${{ needs.jds-do-not-panic-if-jdc-close-connection.result }}" != "success" ] || - [ "${{ needs.jds-do-not-stackoverflow-when-no-token.result }}" != "success" ] || - [ "${{ needs.jds-receive-solution-while-processing-declared-job.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-1-standard.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-close-channel.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-extended_0.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-extended_1.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-reject-auth.result }}" != "success" ] || - [ "${{ needs.standard-coverage.result }}" != "success" ] || - [ "${{ needs.sv1-test.result }}" != "success" ] || - [ "${{ needs.translation-proxy-broke-pool.result }}" != "success" ] || - [ "${{ needs.translation-proxy.result }}" != "success" ] || - [ "${{ needs.translation-proxy-old-share.result }}" != "success" ]; then - echo "One or more jobs failed." - exit 1 - else - echo "All MG tests completed successfully" - fi \ No newline at end of file From 1c474537363fb0bd681e7e9d508fbc64bf202e20 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:01:48 +0200 Subject: [PATCH 34/82] Delete .github/workflows/release-libs.yaml --- .github/workflows/release-libs.yaml | 141 ---------------------------- 1 file changed, 141 deletions(-) delete mode 100644 .github/workflows/release-libs.yaml diff --git a/.github/workflows/release-libs.yaml b/.github/workflows/release-libs.yaml deleted file mode 100644 index 49418675d..000000000 --- a/.github/workflows/release-libs.yaml +++ /dev/null @@ -1,141 +0,0 @@ -# This workflow is used to publish SV2 crates to crates.io -# The workflow tries to update all the library crates, so if a crate is not to updated, the step will fail -# for that each step have continue-on-error set to true. -# Since each step can fail, the output ot the action must be manually checked to make sure that all -# the library intended to be published are published. -# Running cargo release in the various workspace help to prepare the version number and everything. -# ATTENTION -# Is very important to check the output manually cause when too many crates are updated crates.io could fail -# and ask to rerun the action later - -name: Release Libs - -on: - push: - branches: - - main - -jobs: - libs_publish: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Login - run: cargo login ${{ secrets.CRATES_IO_DEPLOY_KEY }} - - name: Publish crate common - continue-on-error: true - run: | - cd common - cargo publish - - name: Publish crate buffer_sv2 - continue-on-error: true - run: | - cd utils/buffer - cargo publish - - name: Publish crate no_serde_sv2_derive_codec - continue-on-error: true - run: | - cd protocols/v2/binary-sv2/no-serde-sv2/derive_codec - cargo publish - - name: Publish crate no_serde_sv2_codec - continue-on-error: true - run: | - cd protocols/v2/binary-sv2/no-serde-sv2/codec - cargo publish - - name: Publish crate serde_sv2 - continue-on-error: true - run: | - cd protocols/v2/binary-sv2/serde-sv2 - cargo publish - - name: Publish crate binary_sv2 - continue-on-error: true - run: | - cd protocols/v2/binary-sv2/binary-sv2 - cargo publish - - name: Publish crate const_sv2 - continue-on-error: true - run: | - cd protocols/v2/const-sv2 - cargo publish - - name: Publish crate framing_sv2 - continue-on-error: true - run: | - cd protocols/v2/framing-sv2 - cargo publish - - name: Publish crate noise_sv2 - continue-on-error: true - run: | - cd protocols/v2/noise-sv2 - cargo publish - - name: Publish crate codec_sv2 - continue-on-error: true - run: | - cd protocols/v2/codec-sv2 - cargo publish - - name: Publish crate common_messages - continue-on-error: true - run: | - cd protocols/v2/subprotocols/common-messages - cargo publish - - name: Publish crate job_declaration - continue-on-error: true - run: | - cd protocols/v2/subprotocols/job-declaration - cargo publish - - name: Publish crate mining - continue-on-error: true - run: | - cd protocols/v2/subprotocols/mining - cargo publish - - name: Publish crate template_distribution - continue-on-error: true - run: | - cd protocols/v2/subprotocols/template-distribution - cargo publish - - name: Publish crate sv2_ffi - continue-on-error: true - run: | - cd protocols/v2/sv2-ffi - cargo publish --all-features - - name: Publish crate roles_logic_sv2 - continue-on-error: true - run: | - cd protocols/v2/roles-logic-sv2 - cargo publish - - name: Publish crate v1 - continue-on-error: true - run: | - cd protocols/v1 - cargo publish - - name: Publish crate bip32-key-derivation - continue-on-error: true - run: | - cd utils/bip32-key-derivation - cargo publish - - name: Publish crate error-handling - continue-on-error: true - run: | - cd utils/error-handling - cargo publish - - name: Publish crate key-utils - continue-on-error: true - run: | - cd utils/key-utils - cargo publish - - name: Publish crate network_helpers_sv2 - continue-on-error: true - run: | - cd roles/roles-utils/network-helpers - cargo publish - - name: Publish crate rpc_sv2 - continue-on-error: true - run: | - cd roles/roles-utils/rpc - cargo publish \ No newline at end of file From bf60e520472497887613dafc140ad95a09b1bfb4 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:01:59 +0200 Subject: [PATCH 35/82] Delete .github/workflows/run-and-track-benchmarks-on-main.yaml --- .../run-and-track-benchmarks-on-main.yaml | 124 ------------------ 1 file changed, 124 deletions(-) delete mode 100644 .github/workflows/run-and-track-benchmarks-on-main.yaml diff --git a/.github/workflows/run-and-track-benchmarks-on-main.yaml b/.github/workflows/run-and-track-benchmarks-on-main.yaml deleted file mode 100644 index 33be08bc5..000000000 --- a/.github/workflows/run-and-track-benchmarks-on-main.yaml +++ /dev/null @@ -1,124 +0,0 @@ -name: Run and Track Benchmarks On Main - -on: - push: - branches: - - main - -jobs: - benchmark_sv1_criterion_with_bencher: - name: Track sv1 criterion benchmarks with Bencher - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv1 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/checkout@v4 - - uses: bencherdev/bencher@main - - name: Benchmark with Bencher - run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench criterion_sv1_benchmark" - - benchmark_sv2_criterion_with_bencher: - name: Track sv2 criterion benchmarks with Bencher - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv2 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/checkout@v4 - - uses: bencherdev/bencher@main - - name: Benchmark with Bencher - run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench criterion_sv2_benchmark" - - benchmark_sv1_iai_with_bencher: - name: Track sv1 iai benchmarks with Bencher - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv1 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - uses: actions/checkout@v4 - - uses: bencherdev/bencher@main - - name: Benchmark with Bencher - run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench iai_sv1_benchmark" - - benchmark_sv2_iai_with_bencher: - name: Track sv2 iai benchmarks with Bencher - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv2 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - uses: actions/checkout@v4 - - uses: bencherdev/bencher@main - - name: Benchmark with Bencher - run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench iai_sv2_benchmark" \ No newline at end of file From d7a07a40ad83a4c3bf762da3c77f2805315d04f3 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:02:11 +0200 Subject: [PATCH 36/82] Delete .github/workflows/run-benchmarks.yaml --- .github/workflows/run-benchmarks.yaml | 125 -------------------------- 1 file changed, 125 deletions(-) delete mode 100644 .github/workflows/run-benchmarks.yaml diff --git a/.github/workflows/run-benchmarks.yaml b/.github/workflows/run-benchmarks.yaml deleted file mode 100644 index 150188218..000000000 --- a/.github/workflows/run-benchmarks.yaml +++ /dev/null @@ -1,125 +0,0 @@ -name: Run and Cache Benchmarks - -on: - pull_request: - branches: - - main - - dev - -jobs: - benchmark_sv1_criterion: - name: Run and cache criterion sv1 benchmarks - runs-on: ubuntu-latest - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Run Benchmarks - run: | - cd benches - cargo bench --bench criterion_sv1_benchmark > criterion_sv1_benchmarks.txt - - - name: Upload Benchmark Results - uses: actions/upload-artifact@v4 - with: - name: criterion_sv1_benchmarks.txt - path: ./benches/criterion_sv1_benchmarks.txt - - - benchmark_sv2_criterion: - name: Run and cache criterion sv2 benchmarks - runs-on: ubuntu-latest - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Run Benchmarks - run: | - cd benches - cargo bench --bench criterion_sv2_benchmark > criterion_sv2_benchmarks.txt - - - name: Upload Benchmark Results - uses: actions/upload-artifact@v4 - with: - name: criterion_sv2_benchmarks.txt - path: ./benches/criterion_sv2_benchmarks.txt - - benchmark_sv1_iai: - name: Run and cache iai sv1 benchmarks - runs-on: ubuntu-latest - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - name: Run Benchmarks - run: | - cd benches - cargo bench --bench iai_sv1_benchmark > iai_sv1_benchmarks.txt - - - name: Upload Benchmark Results - uses: actions/upload-artifact@v4 - with: - name: iai_sv1_benchmarks.txt - path: ./benches/iai_sv1_benchmarks.txt - - benchmark_sv2_iai: - name: Run and cache iai sv2 benchmarks - runs-on: ubuntu-latest - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - name: Run Benchmarks - run: | - cd benches - cargo bench --bench iai_sv2_benchmark > iai_sv2_benchmarks.txt - - - name: Upload Benchmark Results - uses: actions/upload-artifact@v4 - with: - name: iai_sv2_benchmarks.txt - path: ./benches/iai_sv2_benchmarks.txt - - - name: Upload GitHub Pull Request Event - uses: actions/upload-artifact@v4 - with: - name: event.json - path: ${{ github.event_path }} From 2ead55ac8165711a59695fb8c438216b493eaa71 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:02:21 +0200 Subject: [PATCH 37/82] Delete .github/workflows/rust-msrv.yaml --- .github/workflows/rust-msrv.yaml | 37 -------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .github/workflows/rust-msrv.yaml diff --git a/.github/workflows/rust-msrv.yaml b/.github/workflows/rust-msrv.yaml deleted file mode 100644 index 3384e4a2f..000000000 --- a/.github/workflows/rust-msrv.yaml +++ /dev/null @@ -1,37 +0,0 @@ -on: - push: - branches: - - main - - dev - pull_request: - branches: - - main - - dev - -name: MSRV 1.75 Check - -jobs: - - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - rust: - - 1.75.0 # MSRV - - steps: - - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v1.2.0 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - - name: Build Benches - run: cargo build --manifest-path=benches/Cargo.toml - - name: Build Protocols - run: cargo build --manifest-path=protocols/Cargo.toml - - name: Build Roles - run: cargo build --manifest-path=roles/Cargo.toml - - name: Build Utils - run: cargo build --manifest-path=utils/Cargo.toml From b3cf6dae2f0ae57aedd1069b97f9b01e451a0ede Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:02:31 +0200 Subject: [PATCH 38/82] Delete .github/workflows/semver-check.yaml --- .github/workflows/semver-check.yaml | 131 ---------------------------- 1 file changed, 131 deletions(-) delete mode 100644 .github/workflows/semver-check.yaml diff --git a/.github/workflows/semver-check.yaml b/.github/workflows/semver-check.yaml deleted file mode 100644 index 9a2a45ad3..000000000 --- a/.github/workflows/semver-check.yaml +++ /dev/null @@ -1,131 +0,0 @@ -name: Semver Check - -on: - push: - branches: - - "main" - - "dev" - pull_request: - branches: - - "main" - - "dev" - -jobs: - semver-check: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Cache Cargo registry - uses: actions/cache@v2 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo index - uses: actions/cache@v2 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index- - - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y cmake - - - name: Install cargo-semver-checks - run: cargo install cargo-semver-checks --locked - - - name: Run semver checks for common - working-directory: common - run: cargo semver-checks - - - name: Run semver checks for utils/buffer - working-directory: utils/buffer - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/no-serde-sv2/codec - working-directory: protocols/v2/binary-sv2/no-serde-sv2/codec - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/serde-sv2 - working-directory: protocols/v2/binary-sv2/serde-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/binary-sv2 - working-directory: protocols/v2/binary-sv2/binary-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/const-sv2 - working-directory: protocols/v2/const-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/framing-sv2 - working-directory: protocols/v2/framing-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/noise-sv2 - working-directory: protocols/v2/noise-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/codec-sv2 - working-directory: protocols/v2/codec-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/common-messages - working-directory: protocols/v2/subprotocols/common-messages - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/job-declaration - working-directory: protocols/v2/subprotocols/job-declaration - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/mining - working-directory: protocols/v2/subprotocols/mining - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/template-distribution - working-directory: protocols/v2/subprotocols/template-distribution - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/sv2-ffi - working-directory: protocols/v2/sv2-ffi - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/roles-logic-sv2 - working-directory: protocols/v2/roles-logic-sv2 - run: cargo semver-checks --default-features - - - name: Run semver checks for protocols/v1 - working-directory: protocols/v1 - run: cargo semver-checks - - - name: Run semver checks for utils/bip32-key-derivation - working-directory: utils/bip32-key-derivation - run: cargo semver-checks - - - name: Run semver checks for utils/error-handling - working-directory: utils/error-handling - run: cargo semver-checks - - - name: Run semver checks for utils/key-utils - working-directory: utils/key-utils - run: cargo semver-checks - - - name: Run semver checks for roles/roles-utils/network-helpers - working-directory: roles/roles-utils/network-helpers - run: cargo semver-checks - - - name: Run semver checks for roles/roles-utils/rpc - working-directory: roles/roles-utils/rpc - run: cargo semver-checks \ No newline at end of file From 55ea8a66909fecc6afc55bce70885653ebbd1c8d Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:02:41 +0200 Subject: [PATCH 39/82] Delete .github/workflows/sv2-header-check.yaml --- .github/workflows/sv2-header-check.yaml | 32 ------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .github/workflows/sv2-header-check.yaml diff --git a/.github/workflows/sv2-header-check.yaml b/.github/workflows/sv2-header-check.yaml deleted file mode 100644 index 732bd316b..000000000 --- a/.github/workflows/sv2-header-check.yaml +++ /dev/null @@ -1,32 +0,0 @@ -on: - push: - branches: [ main, dev ] - pull_request: - branches: [ main, dev ] - -# Check sv2.h file is up to date with commit -name: sv2.h Header Check - -jobs: - sv2_header_check: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - ubuntu-latest - include: - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - - steps: - - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - - with: - profile: minimal - toolchain: 1.65.0 - override: true - - name: Check sv2 header file is up to date with commit - run: | - echo Check sv2 header file is up to date with commit - sh ./scripts/sv2-header-check.sh From a0500a18e18c7450c49d2451246b71f2ad63a86c Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:02:49 +0200 Subject: [PATCH 40/82] Delete .github/workflows/test.yaml --- .github/workflows/test.yaml | 93 ------------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 5b669ebc0..000000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,93 +0,0 @@ -on: - push: - branches: - - main - - dev - pull_request: - branches: - - main - - dev - -name: Test, Prop Tests, Example Tests - -jobs: - ci: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - macos-latest - - ubuntu-latest - include: - - os: macos-latest - target: x86_64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - - steps: - - name: Install stable toolchain & components - uses: actions/checkout@v4 - with: - profile: minimal - toolchain: nightly - override: true - - - name: Build - run: | - cargo build --manifest-path=benches/Cargo.toml - cargo build --manifest-path=common/Cargo.toml - cargo build --manifest-path=protocols/Cargo.toml - cargo build --manifest-path=roles/Cargo.toml - cargo build --manifest-path=utils/Cargo.toml - - - name: Run sv1-client-and-server example - run: | - cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 - - - name: interop-test - run: | - if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - ./run.sh 30 - else - echo "Skipping interop-test on ${{ matrix.os }} - not supported" - fi - working-directory: examples/interop-cpp/ - - # TODO this is only usefull if we want to build c bindings with guix - #- name: interop-no-cargo-test - # run: | - # if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - # ./run.sh 30 - # else - # echo "Skipping interop-test on ${{ matrix.os }} - not supported" - # fi - # working-directory: examples/interop-cpp-no-cargo/ - - - name: fuzz tests - run: | - if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - ./run.sh 30 - else - echo "Skipping fuzz test on ${{ matrix.os }} - not supported" - fi - working-directory: utils/buffer/fuzz - - - name: Test - run: | - cargo test --manifest-path=benches/Cargo.toml - cargo test --manifest-path=common/Cargo.toml - cargo test --manifest-path=protocols/Cargo.toml - cargo test --manifest-path=roles/Cargo.toml - cargo test --manifest-path=utils/Cargo.toml - - - name: Property based testing - run: | - cargo test --manifest-path=protocols/Cargo.toml --features prop_test - - - name: Run ping-pong-with-noise example - run: | - cargo run --manifest-path=examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10 - - - name: Run ping-pong-without-noise example - run: | - cargo run --manifest-path=examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10 From 7b7f07efd55223395d61c6b80b57cb4f0d07e388 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:02:57 +0200 Subject: [PATCH 41/82] Delete .github/workflows/track-benchmarks.yaml --- .github/workflows/track-benchmarks.yaml | 264 ------------------------ 1 file changed, 264 deletions(-) delete mode 100644 .github/workflows/track-benchmarks.yaml diff --git a/.github/workflows/track-benchmarks.yaml b/.github/workflows/track-benchmarks.yaml deleted file mode 100644 index 1a81de933..000000000 --- a/.github/workflows/track-benchmarks.yaml +++ /dev/null @@ -1,264 +0,0 @@ -name: Track Benchmarks - -on: - workflow_run: - workflows: [Run and Cache Benchmarks] - types: - - completed - -jobs: - track_sv1_criterion_with_bencher: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv1 - BENCHMARK_RESULTS: criterion_sv1_benchmarks.txt - PR_EVENT: event.json - steps: - - name: Download Benchmark Results - uses: actions/github-script@v6 - with: - script: | - async function downloadArtifact(artifactName) { - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip - - name: Export PR Event Data - uses: actions/github-script@v6 - with: - script: | - let fs = require('fs'); - let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); - core.exportVariable("PR_HEAD", `${prEvent.number}/merge`); - core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); - core.exportVariable("PR_DEFAULT", prEvent.pull_request.base.repo.default_branch); - core.exportVariable("PR_NUMBER", prEvent.number); - - uses: bencherdev/bencher@main - - name: Track Benchmarks with Bencher - run: | - bencher run \ - --if-branch '${{ env.PR_HEAD }}' \ - --else-if-branch '${{ env.PR_BASE }}' \ - --else-if-branch '${{ env.PR_DEFAULT }}' \ - --ci-number '${{ env.PR_NUMBER }}' \ - --github-actions "${{ secrets.GITHUB_TOKEN }}" \ - --token "${{ secrets.BENCHER_API_TOKEN }}" \ - --err \ - --file "$BENCHMARK_RESULTS" - - track_sv2_criterion_with_bencher: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv2 - BENCHMARK_RESULTS: criterion_sv2_benchmarks.txt - PR_EVENT: event.json - steps: - - name: Download Benchmark Results - uses: actions/github-script@v6 - with: - script: | - async function downloadArtifact(artifactName) { - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip - - name: Export PR Event Data - uses: actions/github-script@v6 - with: - script: | - let fs = require('fs'); - let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); - core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref); - core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); - core.exportVariable("PR_DEFAULT", prEvent.pull_request.base.repo.default_branch); - core.exportVariable("PR_NUMBER", prEvent.number); - - uses: bencherdev/bencher@main - - name: Track Benchmarks with Bencher - run: | - bencher run \ - --if-branch '${{ env.PR_HEAD }}' \ - --else-if-branch '${{ env.PR_BASE }}' \ - --else-if-branch '${{ env.PR_DEFAULT }}' \ - --ci-number '${{ env.PR_NUMBER }}' \ - --github-actions "${{ secrets.GITHUB_TOKEN }}" \ - --token "${{ secrets.BENCHER_API_TOKEN }}" \ - --err \ - --file "$BENCHMARK_RESULTS" - - track_sv1_iai_with_bencher: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv1 - BENCHMARK_RESULTS: iai_sv1_benchmarks.txt - PR_EVENT: event.json - steps: - - name: Download Benchmark Results - uses: actions/github-script@v6 - with: - script: | - async function downloadArtifact(artifactName) { - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip - - name: Export PR Event Data - uses: actions/github-script@v6 - with: - script: | - let fs = require('fs'); - let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); - core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref); - core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); - core.exportVariable("PR_DEFAULT", prEvent.pull_request.base.repo.default_branch); - core.exportVariable("PR_NUMBER", prEvent.number); - - uses: bencherdev/bencher@main - - name: Track Benchmarks with Bencher - run: | - bencher run \ - --if-branch '${{ env.PR_HEAD }}' \ - --else-if-branch '${{ env.PR_BASE }}' \ - --else-if-branch '${{ env.PR_DEFAULT }}' \ - --ci-number '${{ env.PR_NUMBER }}' \ - --github-actions "${{ secrets.GITHUB_TOKEN }}" \ - --token "${{ secrets.BENCHER_API_TOKEN }}" \ - --err \ - --file "$BENCHMARK_RESULTS" - - track_sv2_iai_with_bencher: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv2 - BENCHMARK_RESULTS: iai_sv2_benchmarks.txt - PR_EVENT: event.json - steps: - - name: Download Benchmark Results - uses: actions/github-script@v6 - with: - script: | - async function downloadArtifact(artifactName) { - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip - - name: Export PR Event Data - uses: actions/github-script@v6 - with: - script: | - let fs = require('fs'); - let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); - core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref); - core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); - core.exportVariable("PR_DEFAULT", prEvent.pull_request.base.repo.default_branch); - core.exportVariable("PR_NUMBER", prEvent.number); - - uses: bencherdev/bencher@main - - name: Track Benchmarks with Bencher - run: | - bencher run \ - --if-branch '${{ env.PR_HEAD }}' \ - --else-if-branch '${{ env.PR_BASE }}' \ - --else-if-branch '${{ env.PR_DEFAULT }}' \ - --ci-number '${{ env.PR_NUMBER }}' \ - --github-actions "${{ secrets.GITHUB_TOKEN }}" \ - --token "${{ secrets.BENCHER_API_TOKEN }}" \ - --err \ - --file "$BENCHMARK_RESULTS" \ No newline at end of file From 781c4186e78aa999d2b10b799774355b3ba7f53c Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:16:30 +0200 Subject: [PATCH 42/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 42d9ba076..f1a73ce35 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -3,8 +3,8 @@ name: Auto Rebase on: push: branches: - - main # Ogni volta che viene fatto un push sul branch `main`, la action viene eseguita. - workflow_dispatch: # Permette di eseguire manualmente la action dal tab Actions su GitHub. + - main # Triggera la action quando c'è un push sul branch `main` + workflow_dispatch: # Permette di eseguire manualmente la action dal tab Actions su GitHub jobs: rebase: @@ -14,11 +14,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Set up GitHub CLI - uses: actions/setup-gh@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Fetch open pull requests id: fetch_prs run: | From a44116a9ec0d85ce03d10e27cd08e2103d1930dc Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:17:49 +0200 Subject: [PATCH 43/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index f1a73ce35..3c68c9bd0 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -14,10 +14,17 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Set GH_TOKEN environment variable + run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Fetch open pull requests - id: fetch_prs run: | + gh auth setup-git gh pr list --state open --json number --jq '.[].number' > pr_numbers.txt + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Rebase pull requests run: | @@ -29,4 +36,4 @@ jobs: git push --force-with-lease done < pr_numbers.txt env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 032868f2d277082107e43131ea70b4acab7f47ff Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:47:22 +0200 Subject: [PATCH 44/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 3c68c9bd0..37e8f3e0d 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -3,8 +3,8 @@ name: Auto Rebase on: push: branches: - - main # Triggera la action quando c'è un push sul branch `main` - workflow_dispatch: # Permette di eseguire manualmente la action dal tab Actions su GitHub + - main + workflow_dispatch: jobs: rebase: @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + with: + fetch-depth: 0 # Fetch completo per evitare problemi di cronologia - name: Set GH_TOKEN environment variable run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV @@ -26,13 +28,34 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Debug Branches + run: | + echo "Current branch: $(git branch --show-current)" + git remote -v + git branch -a + git log --oneline --graph --all --decorate + echo "Fetching latest changes from origin" + git fetch --all + git status + - name: Rebase pull requests run: | while read pr; do echo "Rebasing PR #$pr" gh pr checkout $pr git fetch origin main - git rebase origin/main + + # Check commit difference between PR branch and main + DIFF_COMMITS=$(git rev-list --count HEAD ^origin/main) + echo "Commits to rebase: $DIFF_COMMITS" + + # Rebase and handle conflicts + git rebase origin/main || { + echo "Conflict detected. Aborting rebase and continuing." + git rebase --abort + continue + } + git push --force-with-lease done < pr_numbers.txt env: From 838e7d9eb83a85b131519e779b1f062a446aa2de Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:53:27 +0200 Subject: [PATCH 45/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 37e8f3e0d..1d759af5b 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -14,7 +14,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 with: - fetch-depth: 0 # Fetch completo per evitare problemi di cronologia + fetch-depth: 0 # Fetch completo per avere tutta la cronologia - name: Set GH_TOKEN environment variable run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV @@ -28,19 +28,19 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Debug Branches - run: | - echo "Current branch: $(git branch --show-current)" - git remote -v - git branch -a - git log --oneline --graph --all --decorate - echo "Fetching latest changes from origin" - git fetch --all - git status - - name: Rebase pull requests run: | while read pr; do + echo "Processing PR #$pr" + + # Get PR author information + AUTHOR_NAME=$(gh pr view $pr --json author --jq '.author.login') + AUTHOR_EMAIL="$AUTHOR_NAME@users.noreply.github.com" + + # Set Git author info + git config user.name "$AUTHOR_NAME" + git config user.email "$AUTHOR_EMAIL" + echo "Rebasing PR #$pr" gh pr checkout $pr git fetch origin main From a01997df99e3e49f8611701b7c13f10ee0b847d6 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:15:30 +0200 Subject: [PATCH 46/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 36 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 1d759af5b..1751d54f1 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -24,39 +24,37 @@ jobs: - name: Fetch open pull requests run: | gh auth setup-git - gh pr list --state open --json number --jq '.[].number' > pr_numbers.txt + gh pr list --state open --json number,headRepositoryOwner,headRefName --jq '.[] | "\(.number) \(.headRepositoryOwner.login) \(.headRefName)"' > pr_details.txt env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Rebase pull requests run: | - while read pr; do - echo "Processing PR #$pr" + while read pr_number pr_owner pr_branch; do + echo "Processing PR #$pr_number" - # Get PR author information - AUTHOR_NAME=$(gh pr view $pr --json author --jq '.author.login') - AUTHOR_EMAIL="$AUTHOR_NAME@users.noreply.github.com" + # 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 - # Set Git author info - git config user.name "$AUTHOR_NAME" - git config user.email "$AUTHOR_EMAIL" + # Fetch the contributor's branches + git fetch contributor - echo "Rebasing PR #$pr" - gh pr checkout $pr - git fetch origin main - - # Check commit difference between PR branch and main - DIFF_COMMITS=$(git rev-list --count HEAD ^origin/main) - echo "Commits to rebase: $DIFF_COMMITS" + # Checkout the branch from the contributor's fork + git checkout -b contributor-branch contributor/$pr_branch - # Rebase and handle conflicts + # 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 } - git push --force-with-lease - done < pr_numbers.txt + # 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 + done < pr_details.txt env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From de6f4d0b3d77efef695754300bae02e7c2beb46f Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:18:24 +0200 Subject: [PATCH 47/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 1751d54f1..9ae2808d1 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -42,6 +42,13 @@ jobs: # 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 || { From 603bb16791ddc23d96f2aa1cd63b1408d22a9a9f Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:23:15 +0200 Subject: [PATCH 48/82] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1b2cd119..dce13e43f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - +# TEST!!


SRI From 4127c9aded00dc2684fee05bfe157954b172a50a Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:37:29 +0200 Subject: [PATCH 49/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 9ae2808d1..35ea28092 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -17,16 +17,16 @@ jobs: fetch-depth: 0 # Fetch completo per avere tutta la cronologia - name: Set GH_TOKEN environment variable - run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV + run: echo "GH_TOKEN=${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }}" >> $GITHUB_ENV env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} - 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: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} - name: Rebase pull requests run: | @@ -64,4 +64,4 @@ jobs: git remote remove contributor done < pr_details.txt env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} From 994382df2963abe137ae0d792e3959405f302a0f Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:38:37 +0200 Subject: [PATCH 50/82] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index dce13e43f..70d27d3fc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # TEST!! +## TEST2!!


SRI From 46566bb9ee99e9955807a50a95fab54138ac68a5 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:55:43 +0200 Subject: [PATCH 51/82] Create autorebase.yaml --- .github/workflows/autorebase.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/autorebase.yaml diff --git a/.github/workflows/autorebase.yaml b/.github/workflows/autorebase.yaml new file mode 100644 index 000000000..167ede7d2 --- /dev/null +++ b/.github/workflows/autorebase.yaml @@ -0,0 +1,23 @@ +on: + push: + branches: + - main + # Run when pull requests get labeled + pull_request: + types: [labeled] + +jobs: + auto-rebase: + name: AutoRebase + runs-on: ubuntu-latest + steps: + - uses: Label305/AutoRebase@v0.1 + with: + # We can't use the built-in secrets.GITHUB_TOKEN yet because of this limitation: + # https://github.community/t5/GitHub-Actions/Triggering-a-new-workflow-from-another-workflow/td-p/31676 + # In the meantime, use a token granting write access on the repo: + # - a GitHub App token + # See https://github.com/marketplace/actions/github-app-token. + # - a personal access token + # See https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line. + github_token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} From 7bf5d1a2453dc31be23f956dbb8c8964db5668e9 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:56:55 +0200 Subject: [PATCH 52/82] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 70d27d3fc..f496e23e0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # TEST!! ## TEST2!! +### TEST3!!


SRI From 21516f03daafb0bd0d90b98afc666b217590204c Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:03:36 +0200 Subject: [PATCH 53/82] Update autorebase.yaml --- .github/workflows/autorebase.yaml | 45 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/autorebase.yaml b/.github/workflows/autorebase.yaml index 167ede7d2..881f0f44e 100644 --- a/.github/workflows/autorebase.yaml +++ b/.github/workflows/autorebase.yaml @@ -1,23 +1,26 @@ +name: Automatic Rebase on: - push: - branches: - - main - # Run when pull requests get labeled - pull_request: - types: [labeled] - + issue_comment: + types: [created] jobs: - auto-rebase: - name: AutoRebase - runs-on: ubuntu-latest - steps: - - uses: Label305/AutoRebase@v0.1 - with: - # We can't use the built-in secrets.GITHUB_TOKEN yet because of this limitation: - # https://github.community/t5/GitHub-Actions/Triggering-a-new-workflow-from-another-workflow/td-p/31676 - # In the meantime, use a token granting write access on the repo: - # - a GitHub App token - # See https://github.com/marketplace/actions/github-app-token. - # - a personal access token - # See https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line. - github_token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} + 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: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 # otherwise, you will fail to push refs to dest repo + - 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 }} From 9b301c3a7d13905e574e4f54c518bedd84bc1828 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:05:39 +0200 Subject: [PATCH 54/82] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f496e23e0..27f3aba71 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # TEST!! ## TEST2!! ### TEST3!! +#### TEST4!!


SRI From 25576faf90b4e356de53f43616a7515804ee86d9 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:13:12 +0200 Subject: [PATCH 55/82] Update autorebase.yaml --- .github/workflows/autorebase.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/autorebase.yaml b/.github/workflows/autorebase.yaml index 881f0f44e..a966f1301 100644 --- a/.github/workflows/autorebase.yaml +++ b/.github/workflows/autorebase.yaml @@ -14,9 +14,10 @@ jobs: ) steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: - token: ${{ secrets.GITHUB_TOKEN }} + persist-credentials: false + token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} fetch-depth: 0 # otherwise, you will fail to push refs to dest repo - name: Automatic Rebase uses: cirrus-actions/rebase@1.8 From 8ecc6bf83aaf6db20cf5b63cc1aee1cd18542355 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:15:04 +0200 Subject: [PATCH 56/82] Update autorebase.yaml --- .github/workflows/autorebase.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/autorebase.yaml b/.github/workflows/autorebase.yaml index a966f1301..b2a2361b9 100644 --- a/.github/workflows/autorebase.yaml +++ b/.github/workflows/autorebase.yaml @@ -14,9 +14,9 @@ jobs: ) steps: - name: Checkout the latest code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: - persist-credentials: false + #persist-credentials: false token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} fetch-depth: 0 # otherwise, you will fail to push refs to dest repo - name: Automatic Rebase From 818bc89d3340da2b97a1e67acad55e52cb37278d Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:18:13 +0200 Subject: [PATCH 57/82] Update autorebase.yaml --- .github/workflows/autorebase.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/autorebase.yaml b/.github/workflows/autorebase.yaml index b2a2361b9..b3daf2c16 100644 --- a/.github/workflows/autorebase.yaml +++ b/.github/workflows/autorebase.yaml @@ -19,6 +19,12 @@ jobs: #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: From d61207d4dadc8f517f117c0777bfb74f340a86cb Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:21:24 +0200 Subject: [PATCH 58/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 35ea28092..822221f63 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -12,8 +12,9 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: + token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} fetch-depth: 0 # Fetch completo per avere tutta la cronologia - name: Set GH_TOKEN environment variable From 6fd5c089c6f30c494e7461ff6286d574faa9b990 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:22:08 +0200 Subject: [PATCH 59/82] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 27f3aba71..52997b1fe 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ## TEST2!! ### TEST3!! #### TEST4!! +##### TEST5


SRI From b5f89ce2dce2e58a30de8731bfaafff3cfda42c5 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:53:06 +0200 Subject: [PATCH 60/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 822221f63..a40044637 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} fetch-depth: 0 # Fetch completo per avere tutta la cronologia From c40a430730d3030a4bfeee82a54ee0f986ccdd61 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:55:03 +0200 Subject: [PATCH 61/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index a40044637..631ff83b1 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -14,6 +14,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 with: + persist-credentials: false token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} fetch-depth: 0 # Fetch completo per avere tutta la cronologia From 2fa22de45a06b3235f2399e6e119f6482b549c11 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:59:22 +0200 Subject: [PATCH 62/82] Create auto-rebase-with-github-token --- .../workflows/auto-rebase-with-github-token | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/auto-rebase-with-github-token diff --git a/.github/workflows/auto-rebase-with-github-token b/.github/workflows/auto-rebase-with-github-token new file mode 100644 index 000000000..20d8289e7 --- /dev/null +++ b/.github/workflows/auto-rebase-with-github-token @@ -0,0 +1,64 @@ +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.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 + done < pr_details.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub From e7ea0bbcb49a2bb46ed7acf439cd625ac21f8381 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:00:36 +0200 Subject: [PATCH 63/82] Update auto-rebase-with-github-token --- .github/workflows/auto-rebase-with-github-token | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-rebase-with-github-token b/.github/workflows/auto-rebase-with-github-token index 20d8289e7..539535f3b 100644 --- a/.github/workflows/auto-rebase-with-github-token +++ b/.github/workflows/auto-rebase-with-github-token @@ -1,4 +1,4 @@ -name: Auto Rebase +name: Auto Rebase with Github Token on: push: From 34338437b4777f782075b14f272a91dc69442ef4 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:02:06 +0200 Subject: [PATCH 64/82] Rename auto-rebase-with-github-token to auto-rebase-with-github-token.yaml --- ...ebase-with-github-token => auto-rebase-with-github-token.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{auto-rebase-with-github-token => auto-rebase-with-github-token.yaml} (100%) diff --git a/.github/workflows/auto-rebase-with-github-token b/.github/workflows/auto-rebase-with-github-token.yaml similarity index 100% rename from .github/workflows/auto-rebase-with-github-token rename to .github/workflows/auto-rebase-with-github-token.yaml From ae1383a5f1af1361093037acd0407b80bc3db671 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:04:03 +0200 Subject: [PATCH 65/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 631ff83b1..5a47efccf 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -3,7 +3,7 @@ name: Auto Rebase on: push: branches: - - main + - dev workflow_dispatch: jobs: From 39f89969cc92cfbaeec37157076496937487c856 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:04:34 +0200 Subject: [PATCH 66/82] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52997b1fe..a4699b89f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TEST!! +# TEST! ## TEST2!! ### TEST3!! #### TEST4!! From 109a1b9ab05c3478a27fec442a74c72dd97d90c3 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:06:03 +0200 Subject: [PATCH 67/82] Update auto-rebase-with-github-token.yaml --- .github/workflows/auto-rebase-with-github-token.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/auto-rebase-with-github-token.yaml b/.github/workflows/auto-rebase-with-github-token.yaml index 539535f3b..afb5c9d7b 100644 --- a/.github/workflows/auto-rebase-with-github-token.yaml +++ b/.github/workflows/auto-rebase-with-github-token.yaml @@ -12,9 +12,8 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: - persist-credentials: false token: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub fetch-depth: 0 # Fetch completo per avere tutta la cronologia From c2982568c85511c547cc5051f6318964f5840adb Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:07:27 +0200 Subject: [PATCH 68/82] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a4699b89f..b2fb87f0c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TEST! +# TEST ## TEST2!! ### TEST3!! #### TEST4!! From 639030122629012710582ae786edd7f975d031da Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:10:39 +0200 Subject: [PATCH 69/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 5a47efccf..69612aef9 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -3,7 +3,7 @@ name: Auto Rebase on: push: branches: - - dev + - main workflow_dispatch: jobs: @@ -15,20 +15,15 @@ jobs: uses: actions/checkout@v2 with: persist-credentials: false - token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub fetch-depth: 0 # Fetch completo per avere tutta la cronologia - - name: Set GH_TOKEN environment variable - run: echo "GH_TOKEN=${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }}" >> $GITHUB_ENV - env: - GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} - - 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: - GH_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub - name: Rebase pull requests run: | @@ -59,6 +54,9 @@ jobs: continue } + # Configure Git to use the PAT for this push operation to trigger CI + git remote set-url contributor https://$PAT_TOKEN@github.com/$pr_owner/$(gh repo view --json name -q '.name').git + # Push the rebased branch back to the contributor's fork git push --force-with-lease contributor contributor-branch:$pr_branch @@ -66,4 +64,5 @@ jobs: git remote remove contributor done < pr_details.txt env: - GH_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub + PAT_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Usa il PAT con permessi di `repo` e `workflow` From 250e767cac10de8ecc011fa42966a7bddc701f34 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:17:42 +0200 Subject: [PATCH 70/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 69612aef9..2c590e6fc 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -54,15 +54,18 @@ jobs: continue } - # Configure Git to use the PAT for this push operation to trigger CI - git remote set-url contributor https://$PAT_TOKEN@github.com/$pr_owner/$(gh repo view --json name -q '.name').git - # 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 - PAT_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Usa il PAT con permessi di `repo` e `workflow` From 1885a228a821f2bbfe30362d85e9eb7efb1924a8 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:18:27 +0200 Subject: [PATCH 71/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 2c590e6fc..e4685961d 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -3,7 +3,7 @@ name: Auto Rebase on: push: branches: - - main + - dev workflow_dispatch: jobs: From 20dfaa4d10c4385c289e77b152d898d13578a61b Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:19:18 +0200 Subject: [PATCH 72/82] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2fb87f0c..f688a33f9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # TEST -## TEST2!! +## TEST2 ### TEST3!! #### TEST4!! ##### TEST5 From 14bff9fceea63a00c6b342397a7e7bc7bda99bf4 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:20:09 +0200 Subject: [PATCH 73/82] Update auto-rebase-with-github-token.yaml --- .github/workflows/auto-rebase-with-github-token.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-rebase-with-github-token.yaml b/.github/workflows/auto-rebase-with-github-token.yaml index afb5c9d7b..0b4be6513 100644 --- a/.github/workflows/auto-rebase-with-github-token.yaml +++ b/.github/workflows/auto-rebase-with-github-token.yaml @@ -1,4 +1,4 @@ -name: Auto Rebase with Github Token +name: Auto Rebase wuth Github Token on: push: @@ -12,8 +12,9 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + 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 @@ -58,6 +59,13 @@ jobs: # 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 From 1c64c768d910b43c38e67a68a83353a8071733a0 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:21:02 +0200 Subject: [PATCH 74/82] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f688a33f9..5207443ea 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # TEST ## TEST2 -### TEST3!! +### TEST3 #### TEST4!! ##### TEST5

From 6f3d561bdb08077d32602ada8b40b1d9acaa0a7a Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:27:13 +0200 Subject: [PATCH 75/82] Update fmt.yaml --- .github/workflows/fmt.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/fmt.yaml b/.github/workflows/fmt.yaml index b0b3ecc18..1410fde6a 100644 --- a/.github/workflows/fmt.yaml +++ b/.github/workflows/fmt.yaml @@ -7,6 +7,10 @@ on: branches: - main - dev + workflow_run: + workflows: ["Auto Rebase Github Token"] # Nome del workflow di rebase + types: + - completed name: Rustfmt From ab6e660ec7f8fa75b348c106e8f2c1ef5c719b54 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:27:32 +0200 Subject: [PATCH 76/82] Update fmt.yaml --- .github/workflows/fmt.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fmt.yaml b/.github/workflows/fmt.yaml index 1410fde6a..f2341811f 100644 --- a/.github/workflows/fmt.yaml +++ b/.github/workflows/fmt.yaml @@ -8,7 +8,7 @@ on: - main - dev workflow_run: - workflows: ["Auto Rebase Github Token"] # Nome del workflow di rebase + workflows: ["Auto Rebase wuth Github Token"] # Nome del workflow di rebase types: - completed From 626fa2bfab0924e0aadfe22ce721f012c59f3886 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:28:27 +0200 Subject: [PATCH 77/82] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5207443ea..49f644b2c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # TEST ## TEST2 ### TEST3 -#### TEST4!! +#### TEST4 ##### TEST5


From 00bedbd6a573d960635b0632ca01642755993c63 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:33:14 +0200 Subject: [PATCH 78/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index e4685961d..00a8d720c 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -3,7 +3,7 @@ name: Auto Rebase on: push: branches: - - dev + - main workflow_dispatch: jobs: @@ -15,15 +15,15 @@ jobs: 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 + token: ${{ secrets.GITHUB_TOKEN }} # Use GitHub's default token + fetch-depth: 0 # Fetch full history to have the entire commit history - - name: Fetch open pull requests + - name: Fetch open pull requests with label run: | gh auth setup-git - gh pr list --state open --json number,headRepositoryOwner,headRefName --jq '.[] | "\(.number) \(.headRepositoryOwner.login) \(.headRefName)"' > pr_details.txt + 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.GITHUB_TOKEN }} # Usa il token predefinito di GitHub + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use GitHub's default token - name: Rebase pull requests run: | @@ -68,4 +68,4 @@ jobs: 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 + GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Use GitHub's default token From bd745bbf039742110767170385e84166974a53ef Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:34:52 +0200 Subject: [PATCH 79/82] Update auto-rebase-with-github-token.yaml --- .github/workflows/auto-rebase-with-github-token.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-rebase-with-github-token.yaml b/.github/workflows/auto-rebase-with-github-token.yaml index 0b4be6513..baf2f50e4 100644 --- a/.github/workflows/auto-rebase-with-github-token.yaml +++ b/.github/workflows/auto-rebase-with-github-token.yaml @@ -3,7 +3,7 @@ name: Auto Rebase wuth Github Token on: push: branches: - - main + - dev workflow_dispatch: jobs: From 709b65331797bcb6ab7f203aeeb4d5e89f354275 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:36:53 +0200 Subject: [PATCH 80/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 00a8d720c..005b1b19e 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -12,10 +12,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: - persist-credentials: false - token: ${{ secrets.GITHUB_TOKEN }} # Use GitHub's default token + #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 @@ -23,7 +23,7 @@ jobs: 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.GITHUB_TOKEN }} # Use GitHub's default token + GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Use GitHub's default token - name: Rebase pull requests run: | @@ -59,13 +59,7 @@ jobs: # 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.GITGAB_SRI_PERSONAL_TOKEN }} # Use GitHub's default token From a29a520670100b5073e5acc64126d444f94453a7 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:42:34 +0200 Subject: [PATCH 81/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 005b1b19e..29cded347 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -12,9 +12,9 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: - #persist-credentials: false + 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 @@ -36,8 +36,11 @@ jobs: # 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 contributor-branch contributor/$pr_branch + 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') @@ -55,11 +58,21 @@ jobs: } # Push the rebased branch back to the contributor's fork - git push --force-with-lease contributor contributor-branch:$pr_branch + git push --force-with-lease contributor $unique_branch_name:$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 + + # 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 From e1c8c4664598696a3f067b96602d0b696ad7fa5c Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:44:42 +0200 Subject: [PATCH 82/82] Update auto-rebase.yaml --- .github/workflows/auto-rebase.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml index 29cded347..36786f2c4 100644 --- a/.github/workflows/auto-rebase.yaml +++ b/.github/workflows/auto-rebase.yaml @@ -63,12 +63,8 @@ jobs: # 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 + # Ensure we are not on the branch to be deleted + git checkout main # Delete the local unique branch git branch -D $unique_branch_name