From e6a3c345092ca5da75c108b21296e36ee6a62d20 Mon Sep 17 00:00:00 2001 From: Brian Murray <40031786+brmur@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:36:23 +0000 Subject: [PATCH 1/4] Create issue-metrics.yml (#6224) * Create issue-metrics.yml --- .github/workflows/issue-metrics.yml | 46 +++++++++++++++++++++++++++++ .github/workflows/pr_stats.yml | 18 +++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/issue-metrics.yml create mode 100644 .github/workflows/pr_stats.yml diff --git a/.github/workflows/issue-metrics.yml b/.github/workflows/issue-metrics.yml new file mode 100644 index 00000000000..8bb15c74909 --- /dev/null +++ b/.github/workflows/issue-metrics.yml @@ -0,0 +1,46 @@ +# This workflow searches for issues/pull requests/discussions in a repository, measures several metrics, +# and generates a report in form of a GitHub issue. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/marketplace/actions/issue-metrics + +name: Monthly issue metrics +on: + workflow_dispatch: + schedule: + - cron: '3 2 1 * *' + +permissions: + issues: write + pull-requests: read + +jobs: + build: + name: Issue metrics + runs-on: ubuntu-latest + steps: + - name: Get dates for last month + shell: bash + run: | + # Calculate the first day of the previous month + first_day=$(date -d "last month" +%Y-%m-01) + + # Calculate the last day of the previous month + last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d) + + #Set an environment variable with the date range + echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV" + + - name: Run issue-metrics tool + uses: github/issue-metrics@v2 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SEARCH_QUERY: 'repo:awsdocs/aws-doc-sdk-examples is:issue created:${{ env.last_month }} -reason:"not planned"' + + - name: Create issue + uses: peter-evans/create-issue-from-file@v5 + with: + title: Monthly issue metrics report ${{ env.last_month }} + token: ${{ secrets.GITHUB_TOKEN }} + content-filepath: ./issue_metrics.md diff --git a/.github/workflows/pr_stats.yml b/.github/workflows/pr_stats.yml new file mode 100644 index 00000000000..01f3c8b90cb --- /dev/null +++ b/.github/workflows/pr_stats.yml @@ -0,0 +1,18 @@ +name: Pull Request Stats + +on: + workflow_dispatch: + +jobs: + stats: + runs-on: ubuntu-latest + steps: + - name: Run pull request stats + uses: flowwer-dev/pull-request-stats@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + organization: 'piedpiper' + period: 7 + charts: true + disableLinks: true + sortBy: 'COMMENTS' From 2cff345265a82fc3de15af7f63fe39a012d86c77 Mon Sep 17 00:00:00 2001 From: Corey Pyle Date: Fri, 15 Mar 2024 11:32:41 -0400 Subject: [PATCH 2/4] GitHub: JavaScript - Fix bug where json files were being linted. (#6245) --- .github/workflows/javascript.yml | 4 ++-- javascriptv3/github_scripts/lint.sh | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 javascriptv3/github_scripts/lint.sh diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 9124be367bc..efb779eca5d 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -17,7 +17,7 @@ jobs: .github javascriptv3 - name: Get changed files - id: changed-files + id: changed-jsv3-files uses: tj-actions/changed-files@v41 with: files: "javascriptv3/**/*.{js,ts,jsx,tsx,json}" @@ -36,4 +36,4 @@ jobs: if: steps.changed-files.outputs.any_changed == 'true' run: | changed_files=(${{steps.changed-files.outputs.all_changed_files}}) - npm run --prefix javascriptv3 ci-lint -- ${changed_files[@]//javascriptv3\/} \ No newline at end of file + ./javascriptv3/github_scripts/lint.sh "${changed_files[@]}" \ No newline at end of file diff --git a/javascriptv3/github_scripts/lint.sh b/javascriptv3/github_scripts/lint.sh new file mode 100644 index 00000000000..ef94c3d4346 --- /dev/null +++ b/javascriptv3/github_scripts/lint.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Filter out JSON files +filtered_files=() +for file in "$@"; do + if [[ "$file" != *"javascriptv3/"*.json ]]; then + filtered_files+=("$file") + fi +done + +# Run linting only on filtered files +npm run --prefix javascriptv3 ci-lint -- "${filtered_files[@]//javascriptv3\/}" From 0bed1cb7efe3c034f30a9ff005cdae4cdbb3dd06 Mon Sep 17 00:00:00 2001 From: Corey Pyle Date: Fri, 15 Mar 2024 12:17:14 -0400 Subject: [PATCH 3/4] GitHub: JavaScript - Fix incorrect step id in github action. (#6247) --- .github/workflows/javascript.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index efb779eca5d..b9c511fecbe 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -17,7 +17,7 @@ jobs: .github javascriptv3 - name: Get changed files - id: changed-jsv3-files + id: changed-files uses: tj-actions/changed-files@v41 with: files: "javascriptv3/**/*.{js,ts,jsx,tsx,json}" From 7958117459204a7dc33eced1c10f163ccb3cdc64 Mon Sep 17 00:00:00 2001 From: Corey Pyle Date: Fri, 15 Mar 2024 13:16:23 -0400 Subject: [PATCH 4/4] GitHub: JavaScript - Add execute permission. (#6249) --- javascriptv3/github_scripts/lint.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 javascriptv3/github_scripts/lint.sh diff --git a/javascriptv3/github_scripts/lint.sh b/javascriptv3/github_scripts/lint.sh old mode 100644 new mode 100755