From f090dc5294b8f61d0361d9be94d8cc7363327e82 Mon Sep 17 00:00:00 2001 From: Hundrec Date: Mon, 5 May 2025 23:57:59 -0600 Subject: [PATCH 1/3] Add PR labeler actions --- .github/changed-lines-count-labeler.yml | 12 ++++ .github/label-actions.yml | 56 +++++++++++++++++++ .github/labeler.yml | 36 ++++++++++++ .github/pull_request_template.md | 13 +++++ .github/workflows/cancel-merged-branches.yml | 38 +++++++++++++ .github/workflows/label-actions.yml | 29 ++++++++++ .../label-pull-request-on-create.yml | 19 +++++++ .github/workflows/label-pull-request.yml | 29 ++++++++++ 8 files changed, 232 insertions(+) create mode 100644 .github/changed-lines-count-labeler.yml create mode 100644 .github/label-actions.yml create mode 100644 .github/labeler.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/cancel-merged-branches.yml create mode 100644 .github/workflows/label-actions.yml create mode 100644 .github/workflows/label-pull-request-on-create.yml create mode 100644 .github/workflows/label-pull-request.yml diff --git a/.github/changed-lines-count-labeler.yml b/.github/changed-lines-count-labeler.yml new file mode 100644 index 000000000..9b2f338ce --- /dev/null +++ b/.github/changed-lines-count-labeler.yml @@ -0,0 +1,12 @@ +# Add 'size: small' to any changes below 10 lines +'size: small': + max: 9 + +# Add 'size: medium' to any changes between 10 and 100 lines +'size: medium': + min: 10 + max: 99 + +# Add 'size: large' to any changes of at least 100 lines +'size: large': + min: 100 diff --git a/.github/label-actions.yml b/.github/label-actions.yml new file mode 100644 index 000000000..1779070a7 --- /dev/null +++ b/.github/label-actions.yml @@ -0,0 +1,56 @@ +# Configuration for Label Actions - https://github.com/dessant/label-actions + +# Automatically close pull requests when the `status: duplicate` label is applied +'status: duplicate': + prs: + # Post a comment + comment: > + This pull request is a duplicate. Please direct all discussion to the original pull request. + # Close the pull request + close: true + # Remove other status labels + unlabel: + - 'status: accepted' + - 'status: needs clarification' + - 'status: needs r&d' + - 'status: needs revision' + - 'status: pending triage' + - 'status: rejected' + - 'status: resolved' + - 'status: resolved internally' + - 'status: reviewing internally' + - 'status: stale' + +'status: stale': + prs: + # Close the pull request + close: true + # Remove other status labels + unlabel: + - 'status: accepted' + - 'status: duplicate' + - 'status: needs clarification' + - 'status: needs r&d' + - 'status: needs revision' + - 'status: pending triage' + - 'status: rejected' + - 'status: resolved' + - 'status: resolved internally' + - 'status: reviewing internally' + +'status: rejected': + prs: + # Close the pull request + close: true + # Remove other status labels + unlabel: + - 'status: accepted' + - 'status: duplicate' + - 'status: needs clarification' + - 'status: needs r&d' + - 'status: needs revision' + - 'status: pending triage' + - 'status: resolved' + - 'status: resolved internally' + - 'status: reviewing internally' + - 'status: stale' diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..2637e9dc8 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,36 @@ +# Add Documentation tag to PR's changing markdown files, or anything in the docs folder +'pr: documentation': +- changed-files: + - any-glob-to-any-file: '**/*.md' + +# Add HScript tag to PR's changing hscript files +'pr: hscript': +- changed-files: + - any-glob-to-any-file: '**/*.hxc' + +# Add Chart tag to PR's changing chart files +'pr: chart': +- changed-files: + - any-glob-to-any-file: 'preload/data/songs/**' + +# Add Audio tag to PR's changing audio files +'pr: audio': +- changed-files: + - any-glob-to-any-file: + - '**/*.mp3' + - '**/*.ogg' + +# Add Art tag to PR's changing image or animation files +'pr: art': +- changed-files: + - any-glob-to-any-file: + - 'preload/images/**' + - 'shared/images/**' + - '**/*.png' + +# Add GitHub tag to PR's changing yml files, or anything in the .github folder +'pr: github': +- changed-files: + - any-glob-to-any-file: + - '.github/**' + - '**/*.yml' diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..5dd55bd22 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,13 @@ + + + +## Associated Funkin PR + + +## Linked Issues + + +## Description + + +## Screenshots/Videos diff --git a/.github/workflows/cancel-merged-branches.yml b/.github/workflows/cancel-merged-branches.yml new file mode 100644 index 000000000..254b21a24 --- /dev/null +++ b/.github/workflows/cancel-merged-branches.yml @@ -0,0 +1,38 @@ +name: Cancel queued workflows on PR merge + +on: + pull_request: + types: + - closed + +jobs: + + cancel_stuff: + if: github.event.pull_request.merged == true + runs-on: build-set + permissions: + actions: write + + steps: + - name: Cancel queued workflows for ${{ github.event.pull_request.head.ref }} + uses: actions/github-script@v7 + with: + result-encoding: string + retries: 3 + script: | + let branch_workflows = await github.rest.actions.listWorkflowRuns({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: "build-shit.yml", + status: "queued", + branch: "${{ github.event.pull_request.head.ref }}" + }); + let runs = branch_workflows.data.workflow_runs; + runs.forEach((run) => { + github.rest.actions.cancelWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: run.id + }); + }); + console.log(runs); diff --git a/.github/workflows/label-actions.yml b/.github/workflows/label-actions.yml new file mode 100644 index 000000000..bc4cf0add --- /dev/null +++ b/.github/workflows/label-actions.yml @@ -0,0 +1,29 @@ +# Perform actions when labels are applied to issues, discussions, or pull requests +# See .github/label-actions.yml +name: 'Label Actions' + +on: + issues: + types: + - labeled + - unlabeled + pull_request_target: + types: + - labeled + - unlabeled + discussion: + types: + - labeled + - unlabeled + +permissions: + contents: read + issues: write + pull-requests: write + discussions: write + +jobs: + action: + runs-on: ubuntu-latest + steps: + - uses: dessant/label-actions@v4 diff --git a/.github/workflows/label-pull-request-on-create.yml b/.github/workflows/label-pull-request-on-create.yml new file mode 100644 index 000000000..94620657d --- /dev/null +++ b/.github/workflows/label-pull-request-on-create.yml @@ -0,0 +1,19 @@ +name: "Pull Request Labeler 2 (Runs on PR creation)" +on: + pull_request_target: + types: + - opened + +jobs: + # Apply `status: pending triage` to newly created pull requests + apply-pending-triage: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Apply "status pending triage" to new pull requests + uses: actions-ecosystem/action-add-labels@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + labels: "status: pending triage" diff --git a/.github/workflows/label-pull-request.yml b/.github/workflows/label-pull-request.yml new file mode 100644 index 000000000..525e1b5a6 --- /dev/null +++ b/.github/workflows/label-pull-request.yml @@ -0,0 +1,29 @@ +name: "Pull Request Labeler" +on: +- pull_request_target + +jobs: + # Apply labels to pull requests based on which files were edited + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Set basic labels + uses: actions/labeler@v5 + with: + sync-labels: true + # Apply labels to pull requests based on how many lines were edited + changed-lines-count-labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + name: An action for automatically labelling pull requests based on the changed lines count + steps: + - name: Set change count labels + uses: vkirilichev/changed-lines-count-labeler@v0.2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/changed-lines-count-labeler.yml From b8d72a1c10cd84775761579f633bf4537aa61bbe Mon Sep 17 00:00:00 2001 From: Hundrec Date: Thu, 15 May 2025 23:25:31 -0600 Subject: [PATCH 2/3] Add new size labels for PR labeler --- .github/changed-lines-count-labeler.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/changed-lines-count-labeler.yml b/.github/changed-lines-count-labeler.yml index 9b2f338ce..9637d9d19 100644 --- a/.github/changed-lines-count-labeler.yml +++ b/.github/changed-lines-count-labeler.yml @@ -1,12 +1,22 @@ -# Add 'size: small' to any changes below 10 lines +# Add 'size: tiny' to any changes of at most 4 lines +'size: tiny': + max: 4 + +# Add 'size: small' to any changes between 5 and 10 lines 'size: small': - max: 9 + min: 5 + max: 10 -# Add 'size: medium' to any changes between 10 and 100 lines +# Add 'size: medium' to any changes between 11 and 100 lines 'size: medium': - min: 10 - max: 99 + min: 11 + max: 100 -# Add 'size: large' to any changes of at least 100 lines +# Add 'size: large' to any changes between 101 and 500 lines 'size: large': - min: 100 + min: 101 + max: 500 + +# Add 'size: huge' to any changes of more than 500 lines +'size: huge': + min: 501 From 32eef10a71f17bc35ad4e0d7991365b0a3a586d6 Mon Sep 17 00:00:00 2001 From: TechnikTil Date: Wed, 21 May 2025 15:13:00 -0600 Subject: [PATCH 3/3] use `SongNoteData` for `pico-speaker` and `otis-speaker` animations --- preload/scripts/characters/otis-speaker.hxc | 21 +++++++-------------- preload/scripts/characters/pico-speaker.hxc | 21 +++++++-------------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/preload/scripts/characters/otis-speaker.hxc b/preload/scripts/characters/otis-speaker.hxc index a6a5ce755..7102da0ae 100644 --- a/preload/scripts/characters/otis-speaker.hxc +++ b/preload/scripts/characters/otis-speaker.hxc @@ -22,8 +22,7 @@ import Lambda; class OtisSpeakerCharacter extends SparrowCharacter { - var shootTimes:Array = []; - var shootDirs:Array = []; + var shootNotes:Array = []; var pupilState:Int = 0; @@ -137,7 +136,6 @@ class OtisSpeakerCharacter extends SparrowCharacter { function initTimemap():Void { trace('Initializing Otis timings...'); - shootTimes = []; // The tankmen's timings and directions are determined // by the chart, specifically the internal "picospeaker" difficulty. var animChart:SongDifficulty = PlayState.instance.currentSong.getDifficulty('picospeaker', PlayState.instance.currentVariation); @@ -148,20 +146,14 @@ class OtisSpeakerCharacter extends SparrowCharacter { } else { trace('Initializing Otis (speaker); found `picospeaker` chart, continuing...'); } - var animNotes:Array = animChart.notes; + shootNotes = animChart.notes.copy(); // turns out sorting functions are completely useless in polymod right now and do nothing // i had to sort the whole pico chart by hand im gonna go insane - animNotes.sort(function(a:SongNoteData, b:SongNoteData):Int + shootNotes.sort(function(a:SongNoteData, b:SongNoteData):Int { return FlxSort.byValues(FlxSort.ASCENDING, a.time, b.time); }); - - for (note in animNotes) - { - shootTimes.push(note.time); - shootDirs.push(note.data); - } } override function onUpdate(event:UpdateScriptEvent):Void @@ -245,9 +237,10 @@ class OtisSpeakerCharacter extends SparrowCharacter { } // Each Pico animation is shifted from the array when it's time to play it. - if (shootTimes.length > 0 && shootTimes[0] <= Conductor.instance.songPosition) { - var nextTime:Float = shootTimes.shift(); - var nextDir:Int = shootDirs.shift(); + if (shootNotes.length > 0 && shootNotes[0].time <= Conductor.instance.songPosition) { + var nextNoteData:SongNoteData = shootNotes.shift(); + var nextTime:Float = nextNoteData.time; + var nextDir:Int = nextNoteData.getDirection(); playPicoAnimation(nextDir); } diff --git a/preload/scripts/characters/pico-speaker.hxc b/preload/scripts/characters/pico-speaker.hxc index 36d266f33..49d307a54 100644 --- a/preload/scripts/characters/pico-speaker.hxc +++ b/preload/scripts/characters/pico-speaker.hxc @@ -11,8 +11,7 @@ import funkin.util.SortUtil; import Lambda; class PicoSpeakerCharacter extends SparrowCharacter { - var shootTimes:Array = []; - var shootDirs:Array = []; + var shootNotes:Array = []; function new() { super('pico-speaker'); @@ -45,7 +44,6 @@ class PicoSpeakerCharacter extends SparrowCharacter { function initTimemap():Void { trace('Initializing Pico timings...'); - shootTimes = []; // The tankmen's timings and directions are determined // by the chart, specifically the internal "picospeaker" difficulty. var animChart:SongDifficulty = PlayState.instance.currentSong.getDifficulty('picospeaker'); @@ -56,20 +54,14 @@ class PicoSpeakerCharacter extends SparrowCharacter { } else { trace('Initializing Pico (speaker); found `picospeaker` chart, continuing...'); } - var animNotes:Array = animChart.notes; + shootNotes = animChart.notes.copy(); // turns out sorting functions are completely useless in polymod right now and do nothing // i had to sort the whole pico chart by hand im gonna go insane - animNotes.sort(function(a:SongNoteData, b:SongNoteData):Int + shootNotes.sort(function(a:SongNoteData, b:SongNoteData):Int { return FlxSort.byValues(FlxSort.ASCENDING, a.time, b.time); }); - - for (note in animNotes) - { - shootTimes.push(note.time); - shootDirs.push(note.data); - } } override function onUpdate(event:UpdateScriptEvent):Void @@ -77,9 +69,10 @@ class PicoSpeakerCharacter extends SparrowCharacter { super.onUpdate(event); // Each Pico animation is shifted from the array when it's time to play it. - if (shootTimes.length > 0 && shootTimes[0] <= Conductor.instance.songPosition) { - var nextTime:Float = shootTimes.shift(); - var nextDir:Int = shootDirs.shift(); + if (shootNotes.length > 0 && shootNotes[0].time <= Conductor.instance.songPosition) { + var nextNoteData:SongNoteData = shootNotes.shift(); + var nextTime:Float = nextNoteData.time; + var nextDir:Int = nextNoteData.getDirection(); if(nextDir == 3){ nextDir -= FlxG.random.int(0, 1);