From 352a0e39e2c688abb9975b0def690ad547e68cae Mon Sep 17 00:00:00 2001 From: Ben C Date: Sat, 18 May 2024 16:37:33 -0400 Subject: [PATCH 1/2] Add Mods Checker --- .github/workflows/check-new-mod.yml | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/check-new-mod.yml diff --git a/.github/workflows/check-new-mod.yml b/.github/workflows/check-new-mod.yml new file mode 100644 index 0000000000..3d8dc1fab9 --- /dev/null +++ b/.github/workflows/check-new-mod.yml @@ -0,0 +1,56 @@ +name: Check New Mod + +on: + pull_request: + types: [opened, labeled, synchronize, edited] + branches: [master, source, main] + +permissions: + contents: read + pull-requests: write + checks: write + +jobs: + check-new-mod: + runs-on: ubuntu-latest + env: + modUniqueName: "" + modRepo: "" + if: "${{ contains(github.event.pull_request.labels.*.name, 'add-mod') && startsWith(github.event.pull_request.title, 'Add new mod: ') }}" + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Get Mod Info + id: get-mod-info + run: | + tmp="${{ github.event.pull_request.title }}" + echo "modUniqueName=${tmp:13}" >> $GITHUB_ENV + + pat="https://github.com/([[:alnum:]_\/-]*)" + ser="${{ github.event.pull_request.body }}" + if [[ $ser =~ $pat ]]; then + echo "modRepo=${BASH_REMATCH[1]}" >> $GITHUB_ENV + fi + - name: Initial Comment + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + ### :hourglass: Starting Mod Check + View the `Checks` tab for the status of this check. + - name: Check Mod + id: check-mod + continue-on-error: true + uses: Bwc9876/mods-checker@main + with: + sourceType: repo + source: ${{ env.modRepo }} + overrideName: Check of ${{ env.modUniqueName }} + expectedUniqueName: ${{ env.modUniqueName }} + token: ${{ secrets.GITHUB_TOKEN }} + - name: Final Comment + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: ./results.md + - name: Return + if: ${{ steps.check-mod.outcome == 'failure' }} + run: exit 1 From 38e47cac75e7b5f6b7524534c4ec612d28347bce Mon Sep 17 00:00:00 2001 From: Ben C Date: Sat, 15 Jun 2024 10:57:38 -0400 Subject: [PATCH 2/2] Also on issue comment --- .github/workflows/check-new-mod.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-new-mod.yml b/.github/workflows/check-new-mod.yml index 3d8dc1fab9..e1014b34f6 100644 --- a/.github/workflows/check-new-mod.yml +++ b/.github/workflows/check-new-mod.yml @@ -4,6 +4,8 @@ on: pull_request: types: [opened, labeled, synchronize, edited] branches: [master, source, main] + issue_comment: + types: [created] permissions: contents: read @@ -16,7 +18,7 @@ jobs: env: modUniqueName: "" modRepo: "" - if: "${{ contains(github.event.pull_request.labels.*.name, 'add-mod') && startsWith(github.event.pull_request.title, 'Add new mod: ') }}" + if: "${{ (github.event.comment && github.event.issue.pull_request && contains(github.event.issue.labels.*.name, 'add-mod') && startsWith(github.event.pull_request.title, 'Add new mod: ') && startsWith(github.event.comment.body, 'checker, retry')) || (github.event.pull_request && contains(github.event.pull_request.labels.*.name, 'add-mod') && startsWith(github.event.pull_request.title, 'Add new mod: ')) }}" steps: - name: Checkout uses: actions/checkout@v4 @@ -47,6 +49,7 @@ jobs: overrideName: Check of ${{ env.modUniqueName }} expectedUniqueName: ${{ env.modUniqueName }} token: ${{ secrets.GITHUB_TOKEN }} + - run: echo -e "\nTo re-run the check, comment 'checker, retry' on this PR." >> ./results.md - name: Final Comment uses: thollander/actions-comment-pull-request@v2 with: