Skip to content

Commit

Permalink
ci: update pr-autoscan
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetherinox committed Apr 26, 2024
1 parent a5bac9f commit 90ee6c8
Showing 1 changed file with 42 additions and 34 deletions.
76 changes: 42 additions & 34 deletions .github/workflows/pr-autoscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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: |
Expand All @@ -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: ","
Expand All @@ -172,32 +179,33 @@ 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
# ---------------------------------------------------------------------------------------
# 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 }}
Expand All @@ -206,7 +214,7 @@ jobs:
const escape_html = ( unsafe ) => unsafe.replace( /&/g, '&amp;' ).replace( /</g, '&lt;' ).replace( />/g, '&gt;' ).replace( /"/g, '&quot;' ).replace( /'/g, '&#039;' );
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 }`
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 90ee6c8

Please sign in to comment.