From 90ee6c8fdb9faaa4f598386c113d3a45beaf75f6 Mon Sep 17 00:00:00 2001 From: Aetherinox Date: Fri, 26 Apr 2024 16:14:02 -0700 Subject: [PATCH] ci: update pr-autoscan --- .github/workflows/pr-autoscan.yml | 76 +++++++++++++++++-------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/.github/workflows/pr-autoscan.yml b/.github/workflows/pr-autoscan.yml index 3d4ff30b..b193d493 100644 --- a/.github/workflows/pr-autoscan.yml +++ b/.github/workflows/pr-autoscan.yml @@ -73,7 +73,8 @@ jobs: # however this isnt available for 'issue_comment' # --------------------------------------------------------------------------------------- - - name: 🏷️ Verify Existing Labels + - name: "🏷️ Verify Existing Labels" + id: task_autocheck_labels_verify uses: actions/github-script@v7 with: github-token: ${{ secrets.ADMINSERV_TOKEN_CL || github.token }} @@ -106,11 +107,12 @@ jobs: } # --------------------------------------------------------------------------------------- - # get issue number + # set issue number # --------------------------------------------------------------------------------------- - - uses: actions/github-script@v7 - id: autocheck-get-issue-number + - name: "#️⃣ Issue number › Set" + uses: actions/github-script@v7 + id: task_autocheck_issue_num_set with: github-token: ${{ secrets.ADMINSERV_TOKEN_CL || github.token }} script: | @@ -134,36 +136,41 @@ jobs: result-encoding: string # --------------------------------------------------------------------------------------- - # return issue number + # print issue number # --------------------------------------------------------------------------------------- - - name: Issue number - run: echo '${{ steps.autocheck-get-issue-number.outputs.result }}' + - name: "#️⃣ Issue number › Print" + id: task_autocheck_issue_num_get + run: | + echo '${{ steps.task_autocheck_issue_num_set.outputs.result }}' # --------------------------------------------------------------------------------------- # checkout # --------------------------------------------------------------------------------------- - - uses: actions/checkout@v4 - if: ( github.event_name == 'pull_request_target' ) || ( github.event_name == 'pull_request' ) || ( github.event_name == 'issue_comment' && contains( github.event.comment.html_url, '/pull/' ) && contains( github.event.comment.body, '/rescan' ) ) + - name: "☑️ Checkout" + id: task_autoscan_checkout + uses: actions/checkout@v4 + if: | + ( github.event_name == 'pull_request_target' ) || ( github.event_name == 'pull_request' ) || ( github.event_name == 'issue_comment' && contains( github.event.comment.html_url, '/pull/' ) && contains( github.event.comment.body, '/rescan' ) ) with: fetch-depth: 0 - ref: "refs/pull/${{ steps.autocheck-get-issue-number.outputs.result }}/merge" + ref: "refs/pull/${{ steps.task_autocheck_issue_num_set.outputs.result }}/merge" # --------------------------------------------------------------------------------------- # nodejs # --------------------------------------------------------------------------------------- - - - name: Use Node.js + + - name: "⚙️ Setup Node" + id: task_autocheck_nodejs uses: actions/setup-node@v4 - id: autocheck-nodejs # --------------------------------------------------------------------------------------- # get list of changed files # --------------------------------------------------------------------------------------- - name: Get changed files - id: autocheck-get-changed-files + id: task_autocheck_changed_files_get uses: tj-actions/changed-files@v44 with: separator: "," @@ -172,23 +179,24 @@ jobs: # list of changed files # --------------------------------------------------------------------------------------- - - name: List all added files - id: autocheck-list-added-files + - name: "📄 List all added files" + id: task_autocheck_added_files_get run: | for file in ${CHANGED_FILES}; do echo "$file was changed" done env: - ADDED_FILES: ${{ steps.autocheck-get-changed-files.outputs.added_files }} - MODIFIED_FILES: ${{ steps.autocheck-get-changed-files.outputs.modified_files }} - CHANGED_FILES: ${{ steps.autocheck-get-changed-files.outputs.all_changed_files }} - COUNT_ADDED: ${{ steps.autocheck-get-changed-files.outputs.added_files_count }} - COUNT_MODIFIED: ${{ steps.autocheck-get-changed-files.outputs.modified_files_count }} - COUNT_DELETED: ${{ steps.autocheck-get-changed-files.outputs.deleted_files_count }} - COUNT_RENAMED: ${{ steps.autocheck-get-changed-files.outputs.renamed_files_count }} - COUNT_COPIED: ${{ steps.autocheck-get-changed-files.outputs.copied_files_count }} - - - name: List Directories + ADDED_FILES: ${{ steps.task_autocheck_changed_files_get.outputs.added_files }} + MODIFIED_FILES: ${{ steps.task_autocheck_changed_files_get.outputs.modified_files }} + CHANGED_FILES: ${{ steps.task_autocheck_changed_files_get.outputs.all_changed_files }} + COUNT_ADDED: ${{ steps.task_autocheck_changed_files_get.outputs.added_files_count }} + COUNT_MODIFIED: ${{ steps.task_autocheck_changed_files_get.outputs.modified_files_count }} + COUNT_DELETED: ${{ steps.task_autocheck_changed_files_get.outputs.deleted_files_count }} + COUNT_RENAMED: ${{ steps.task_autocheck_changed_files_get.outputs.renamed_files_count }} + COUNT_COPIED: ${{ steps.task_autocheck_changed_files_get.outputs.copied_files_count }} + + - name: "📂 List Directories" + id: task_autocheck_dirs_list run: | ls @@ -196,8 +204,8 @@ jobs: # Run autocheck # --------------------------------------------------------------------------------------- - - name: Run Autocheck - id: autocheck-run + - name: "☑️ Run Autocheck" + id: task_autocheck_run uses: actions/github-script@v7 with: github-token: ${{ secrets.ADMINSERV_TOKEN_CL || github.token }} @@ -206,7 +214,7 @@ jobs: const escape_html = ( unsafe ) => unsafe.replace( /&/g, '&' ).replace( //g, '>' ).replace( /"/g, '"' ).replace( /'/g, ''' ); const labels = []; - const files_List = `${{ steps.autocheck-get-changed-files.outputs.all_changed_files }}` || '' + const files_List = `${{ steps.task_autocheck_changed_files_get.outputs.all_changed_files }}` || '' const files_Array = files_List.split(',') const branch_ref = `${ context.payload.pull_request.head.ref }` @@ -259,11 +267,11 @@ jobs: | Author | [ ` + context.payload.pull_request.user.login + ` ](https://github.com/` + context.repo.owner + `/) | | Repo | [ ` + context.repo.repo + ` ](https://github.com/` + context.repo.owner + `/` + context.repo.repo + `) | | Branch | [ ` + context.payload.pull_request.head.ref + `](https://github.com/` + context.repo.owner + `/` + context.repo.repo + `/tree/` + context.payload.pull_request.head.ref + `) ⇁ [ ` + context.payload.pull_request.base.ref + `](https://github.com/` + context.repo.owner + `/` + context.repo.repo + `/tree/` + context.payload.pull_request.base.ref + `) | - | Added Files | ${{ steps.autocheck-get-changed-files.outputs.added_files_count }} | - | Modified Files | ${{ steps.autocheck-get-changed-files.outputs.all_modified_files_count }} | - | Renamed Files | ${{ steps.autocheck-get-changed-files.outputs.renamed_files_count }} | - | Copied Files | ${{ steps.autocheck-get-changed-files.outputs.deleted_files_count }} | - | Deleted Files | ${{ steps.autocheck-get-changed-files.outputs.deleted_files_count }} | + | Added Files | ${{ steps.task_autocheck_changed_files_get.outputs.added_files_count }} | + | Modified Files | ${{ steps.task_autocheck_changed_files_get.outputs.all_modified_files_count }} | + | Renamed Files | ${{ steps.task_autocheck_changed_files_get.outputs.renamed_files_count }} | + | Copied Files | ${{ steps.task_autocheck_changed_files_get.outputs.deleted_files_count }} | + | Deleted Files | ${{ steps.task_autocheck_changed_files_get.outputs.deleted_files_count }} | `; message.push ( md_table );