Skip to content

Test #9103

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed

Test #9103

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 0 additions & 79 deletions .github/workflows/Validate-package-lock.yaml

This file was deleted.

105 changes: 105 additions & 0 deletions .github/workflows/autorebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Sync PRs on Push

on:
push:
branches:
- '**'

jobs:
cancel-and-rebase:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
actions: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

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

- name: Cancel running workflows for PRs targeting this branch
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const targetBranch = context.ref.replace('refs/heads/', '');
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
base: targetBranch
});

for (const pr of prs) {
const { data: runs } = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
event: 'pull_request',
branch: pr.head.ref,
status: 'in_progress'
});

for (const run of runs.workflow_runs) {
console.log(`Cancelling run ${run.id} for PR #${pr.number}`);
await github.rest.actions.cancelWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id
});
}
}

- name: Rebase outdated PRs
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const targetBranch = context.ref.replace('refs/heads/', '');
const { execSync } = require('child_process');

const { data: baseBranch } = await github.rest.repos.getBranch({
owner: context.repo.owner,
repo: context.repo.repo,
branch: targetBranch
});
const baseSha = baseBranch.commit.sha;

const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
base: targetBranch
});

for (const pr of prs) {
const comparison = await github.rest.repos.compareCommits({
owner: context.repo.owner,
repo: context.repo.repo,
base: baseSha,
head: pr.head.sha
});

if (comparison.status !== 'behind') {
console.log(`PR #${pr.number} is already based on latest ${targetBranch}`);
continue;
}

try {
console.log(`Rebasing PR #${pr.number}`);
execSync(`git fetch origin ${targetBranch}`, { stdio: 'inherit' });
execSync(`git fetch origin pull/${pr.number}/head:pr-${pr.number}`, { stdio: 'inherit' });
execSync(`git checkout pr-${pr.number}`, { stdio: 'inherit' });
execSync(`git rebase --signoff origin/${targetBranch}`, { stdio: 'inherit' });
execSync(`git push origin HEAD:${pr.head.ref} --force-with-lease`, { stdio: 'inherit' });
} catch (err) {
console.log(`Failed to rebase PR #${pr.number}: ${err.message}`);
}
}
88 changes: 0 additions & 88 deletions .github/workflows/build-arm64-image.yaml

This file was deleted.

88 changes: 0 additions & 88 deletions .github/workflows/build-ppc64le-image.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/ceph-nsfs-s3-tests.yaml

This file was deleted.

Loading