Skip to content

Commit

Permalink
Merge branch 'ss220-space:master220' into SpaceRuinAstroak
Browse files Browse the repository at this point in the history
  • Loading branch information
KA8EP committed Jul 31, 2024
2 parents 8ef6dad + de1ae0f commit 9ba5916
Show file tree
Hide file tree
Showing 468 changed files with 246,959 additions and 49,169 deletions.
37 changes: 33 additions & 4 deletions .github/workflows/label_testmerge_conflicts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,38 @@ on:

jobs:
triage:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: eps1lon/[email protected]
- name: Git checkout
uses: actions/checkout@v4
with:
dirtyLabel: 'Testmerge Conflict'
repoToken: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: testmerge
- name: Check for testmerge conflicts
id: check
run: |
git config --local user.email "[email protected]"
git config --local user.name "Testmerge Conflict Detection"
git fetch origin pull/${{ github.event.number }}/head:PR${{ github.event.number }}
git merge --no-commit --no-ff PR${{ github.event.number }} || true
CONFLICTS=$(git ls-files -u | wc -l)
if [ "$CONFLICTS" -gt 0 ] ; then
echo "There is a merge conflict. Aborting"
git merge --abort
echo "success=0" >> $GITHUB_OUTPUT
exit 0
fi
echo "success=1" >> $GITHUB_OUTPUT
- name: Label PR
uses: jburgess/[email protected]
if: steps.check.outputs.success == 0
with:
githubToken: '${{ secrets.GITHUB_TOKEN }}'
labelsToAdd: 'Testmerge Conflict'
- name: Unlabel PR
uses: jburgess/[email protected]
if: steps.check.outputs.success == 1
with:
githubToken: '${{ secrets.GITHUB_TOKEN }}'
labelsToRemove: 'Testmerge Conflict'
16 changes: 16 additions & 0 deletions .github/workflows/pr-conflicts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Check Potential Conflicts

on:
pull_request:
branches:
- master220

jobs:
build:
name: potential-conflicts-checker
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: outsideris/[email protected]
with:
ghToken: ${{ secrets.GITHUB_TOKEN }}
95 changes: 95 additions & 0 deletions .github/workflows/testmerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: 'Testmerge Worker'

concurrency:
group: testmerge

on:
workflow_dispatch:

env:
BASE_BRANCH: master220
TESTMERGE_BRANCH: testmerge2
REQUIRED_LABEL: testmerge

jobs:
process:
runs-on: ubuntu-latest
steps:
- name: Get pull requests with required label and check for merge conflicts
id: get_labeled_prs
uses: actions/github-script@v7
with:
script: |
const label_needed = '${{ env.REQUIRED_LABEL }}';
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
const labeledPRs = [];
for (const pr of pullRequests) {
if (pr.labels.some(label => label.name === label_needed)) {
const prInfo = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number
});
if (prInfo.data.mergeable) {
labeledPRs.push({
number: pr.number,
title: pr.title
});
}
}
}
const prDetails = JSON.stringify(labeledPRs);
console.log(`Pull Requests with the label "${label_needed}" and no merge conflicts: ${prDetails}`);
if (prDetails.length == 0) {
core.setFailed(`No pull requests with the label "${label_needed}" and no merge conflicts found.`);
}
core.setOutput('labeled_pr_details', prDetails);
- name: Git checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: ${{ env.BASE_BRANCH }}
- name: Iterate over PRs and perform actions
id: prepare_testmerge_branch
run: |
set -e
git config --local user.email "[email protected]"
git config --local user.name "Testmerge Worker"
git switch ${{ env.TESTMERGE_BRANCH }} || git switch -c ${{ env.TESTMERGE_BRANCH }}
git reset --hard ${{ env.BASE_BRANCH }}
# Print debug information
echo "PR details JSON:"
echo '${{ steps.get_labeled_prs.outputs.labeled_pr_details }}'
echo '${{ steps.get_labeled_prs.outputs.labeled_pr_details }}' | jq -c '.[]' | while read -r PR_DETAIL; do
PR_NUMBER=$(echo "$PR_DETAIL" | jq -r '.number')
PR_TITLE=$(echo "$PR_DETAIL" | jq -r '.title')
echo "Preparing $PR_TITLE (#$PR_NUMBER)"
git fetch origin pull/$PR_NUMBER/head:pr-$PR_NUMBER
# Check for merge conflicts
git merge --no-commit --no-ff pr-$PR_NUMBER || true
CONFLICTS=$(git ls-files -u | wc -l)
if [ "$CONFLICTS" -gt 0 ] ; then
echo "There is a merge conflict. Skipping $PR_TITLE (#$PR_NUMBER)"
git merge --abort
continue
fi
git merge --abort
git merge --squash pr-$PR_NUMBER
git commit -m "$PR_TITLE (#$PR_NUMBER) [testmerge]"
# Perform your git actions here, for example:
echo "Successfully merged $PR_TITLE (#$PR_NUMBER)"
done
git push -f origin ${{ env.TESTMERGE_BRANCH }}
4 changes: 2 additions & 2 deletions _build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export NODE_VERSION=18
# Stable Byond Major
export STABLE_BYOND_MAJOR=515
# Stable Byond Minor
export STABLE_BYOND_MINOR=1634
export STABLE_BYOND_MINOR=1642
# Beta Byond Major
export BETA_BYOND_MAJOR=515
# Beta Byond Minor
export BETA_BYOND_MINOR=1634
export BETA_BYOND_MINOR=1642
# For the RUSTG library. Not actually installed by CI but kept as a reference
export RUSTG_VERSION=3.1.0-ss220
#For DMJIT librarry
Expand Down
Loading

0 comments on commit 9ba5916

Please sign in to comment.