From c3f5ae3631be652da3cbe86d16ceb9a29835de23 Mon Sep 17 00:00:00 2001 From: Reshmi Date: Mon, 28 Apr 2025 17:16:51 +0530 Subject: [PATCH 01/21] testing purpose --- .github/actions/monitor-issues/action.yml | 33 +++++++++++++++++++++++ .github/workflows/test-monitor-issues.yml | 18 +++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/actions/monitor-issues/action.yml create mode 100644 .github/workflows/test-monitor-issues.yml diff --git a/.github/actions/monitor-issues/action.yml b/.github/actions/monitor-issues/action.yml new file mode 100644 index 0000000..4d68c95 --- /dev/null +++ b/.github/actions/monitor-issues/action.yml @@ -0,0 +1,33 @@ +name: Monitor Issues + +on: + workflow_call: + inputs: + operations-per-run: + description: 'Number of operations per run' + required: false + default: '30' + secrets: + repo-token: + description: 'GitHub token used to authenticate and modify issues' + required: true + +jobs: + monitor-issues: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/stale@v9 + with: + exempt-issue-labels: 'feature request,question' + days-before-issue-stale: 0 + days-before-issue-close: 0 + stale-issue-label: "stale" + stale-issue-message: "This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days" + close-issue-message: "This issue was closed due to 7 days of inactivity after being marked as stale. Feel free to reopen it if it remains relevant." + days-before-pr-close: false + days-before-pr-stale: false + ascending: true + operations-per-run: ${{ inputs.operations-per-run }} + repo-token: ${{ secrets.repo-token }} diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml new file mode 100644 index 0000000..4871919 --- /dev/null +++ b/.github/workflows/test-monitor-issues.yml @@ -0,0 +1,18 @@ +name: Test Monitor Issues + +on: + workflow_dispatch: + inputs: + operations-per-run: + description: 'Number of operations per run' + required: false + default: '30' + schedule: + - cron: "0 0 * * *" # Runs once a day at midnight + +jobs: + monitor-issues: + uses: ./.github/actions/monitor-issues/monitor-issues.yml + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + operations-per-run: 10 From 1e680de7d07fe40fd669b03ca3bfd9ba326f784c Mon Sep 17 00:00:00 2001 From: Reshmi Date: Mon, 28 Apr 2025 17:24:13 +0530 Subject: [PATCH 02/21] updated workflow --- .github/workflows/test-monitor-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 4871919..0330c27 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -12,7 +12,7 @@ on: jobs: monitor-issues: - uses: ./.github/actions/monitor-issues/monitor-issues.yml + uses: ./.github/actions/monitor-issues/monitor-issues.yml # This is the correct usage with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 10 From 305c80a1c52d28b732fdd7992062f2de0835750a Mon Sep 17 00:00:00 2001 From: Reshmi Date: Mon, 28 Apr 2025 17:30:27 +0530 Subject: [PATCH 03/21] updated workflow --- .github/workflows/test-monitor-issues.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 0330c27..4cb5b9c 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -11,8 +11,8 @@ on: - cron: "0 0 * * *" # Runs once a day at midnight jobs: - monitor-issues: - uses: ./.github/actions/monitor-issues/monitor-issues.yml # This is the correct usage + workflow_call: + uses: ./.github/actions/monitor-issues/monitor-issues.yml with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 10 From d6a328bb75db849fa02fef61db90db37aa7e3c65 Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 17:47:07 +0530 Subject: [PATCH 04/21] Update test-monitor-issues.yml --- .github/workflows/test-monitor-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 4cb5b9c..f907340 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -12,7 +12,7 @@ on: jobs: workflow_call: - uses: ./.github/actions/monitor-issues/monitor-issues.yml + uses: ./.github/actions/monitor-issues@a197af79b89bf5186b2b3304dd09bf844083e897 with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 10 From 2ed6f69c13d4df62f543a7607d44e2781fa8b0f3 Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 17:48:53 +0530 Subject: [PATCH 05/21] Update test-monitor-issues.yml --- .github/workflows/test-monitor-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index f907340..0aa8494 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -12,7 +12,7 @@ on: jobs: workflow_call: - uses: ./.github/actions/monitor-issues@a197af79b89bf5186b2b3304dd09bf844083e897 + uses: ./.github/actions/monitor-issues with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 10 From 7888ddcb601dc1e05b9615b2ed0818f100523057 Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 17:49:57 +0530 Subject: [PATCH 06/21] Update test-monitor-issues.yml --- .github/workflows/test-monitor-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 0aa8494..634b7ca 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -12,7 +12,7 @@ on: jobs: workflow_call: - uses: ./.github/actions/monitor-issues + uses: reshmifrog/.github/actions/monitor-issues@a197af79b89bf5186b2b3304dd09bf844083e897 with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 10 From 555489b944c24c86432fd7f8c408e5185117f446 Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 17:53:50 +0530 Subject: [PATCH 07/21] Update test-monitor-issues.yml From 117a1cf0c97b2b26d6068bbfb7e4b94247d7f740 Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 17:55:37 +0530 Subject: [PATCH 08/21] Update test-monitor-issues.yml --- .github/workflows/test-monitor-issues.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 634b7ca..14983b9 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -14,5 +14,4 @@ jobs: workflow_call: uses: reshmifrog/.github/actions/monitor-issues@a197af79b89bf5186b2b3304dd09bf844083e897 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - operations-per-run: 10 + operations-per-run: 30 From 79a6c7b8ce87b927f255d8408b740f1cbc8efbb1 Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 18:07:18 +0530 Subject: [PATCH 09/21] Update test-monitor-issues.yml --- .github/workflows/test-monitor-issues.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 14983b9..142c1f1 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -14,4 +14,5 @@ jobs: workflow_call: uses: reshmifrog/.github/actions/monitor-issues@a197af79b89bf5186b2b3304dd09bf844083e897 with: + repo-token: ${{ secrets.REPO_TOKEN }} operations-per-run: 30 From c429229a7087c81ac7cb46c4e31933b1a78ee0ee Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 18:09:30 +0530 Subject: [PATCH 10/21] Update test-monitor-issues.yml --- .github/workflows/test-monitor-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 142c1f1..7060e5f 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -12,7 +12,7 @@ on: jobs: workflow_call: - uses: reshmifrog/.github/actions/monitor-issues@a197af79b89bf5186b2b3304dd09bf844083e897 + uses: ./.github/actions/monitor-issues@a197af79b89bf5186b2b3304dd09bf844083e897 with: repo-token: ${{ secrets.REPO_TOKEN }} operations-per-run: 30 From 821896e18bc567a69903aab9cb198cda0bfb9551 Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 18:18:08 +0530 Subject: [PATCH 11/21] Update test-monitor-issues.yml --- .github/workflows/test-monitor-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 7060e5f..ad26ccb 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -12,7 +12,7 @@ on: jobs: workflow_call: - uses: ./.github/actions/monitor-issues@a197af79b89bf5186b2b3304dd09bf844083e897 + uses: reshmifrog/.github/actions/monitor-issues@feature/monitor-issues-reusable with: repo-token: ${{ secrets.REPO_TOKEN }} operations-per-run: 30 From 80573a0fd3bbf708e778ace2b19dc9a8322f82b6 Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 18:20:57 +0530 Subject: [PATCH 12/21] Update test-monitor-issues.yml --- .github/workflows/test-monitor-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index ad26ccb..2436bb6 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -11,7 +11,7 @@ on: - cron: "0 0 * * *" # Runs once a day at midnight jobs: - workflow_call: + workflow_call_1: uses: reshmifrog/.github/actions/monitor-issues@feature/monitor-issues-reusable with: repo-token: ${{ secrets.REPO_TOKEN }} From 57406d4bbeca1aa50fc5c87e574e76a4c8f63e5c Mon Sep 17 00:00:00 2001 From: reshmifrog Date: Mon, 28 Apr 2025 18:21:51 +0530 Subject: [PATCH 13/21] Update test-monitor-issues.yml --- .github/workflows/test-monitor-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 2436bb6..dba5fcb 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -8,7 +8,7 @@ on: required: false default: '30' schedule: - - cron: "0 0 * * *" # Runs once a day at midnight + - cron: "0 0 * * *" # Runs once a day at midnigh jobs: workflow_call_1: From d1f50202671a26f7b9e5caece57186ebf45d4933 Mon Sep 17 00:00:00 2001 From: Reshmi Date: Tue, 29 Apr 2025 15:16:59 +0530 Subject: [PATCH 14/21] added run script and upadte workflow --- .github/actions/monitor-issues/action.yml | 227 +++++++++++++++++++--- .github/workflows/test-monitor-issues.yml | 33 ++-- 2 files changed, 216 insertions(+), 44 deletions(-) diff --git a/.github/actions/monitor-issues/action.yml b/.github/actions/monitor-issues/action.yml index 4d68c95..1a07702 100644 --- a/.github/actions/monitor-issues/action.yml +++ b/.github/actions/monitor-issues/action.yml @@ -1,33 +1,196 @@ -name: Monitor Issues +name: 'Close Stale Issues' +description: 'Closes stale issues in a repository' +inputs: + github-token: + description: 'The GitHub token to use for API requests' + required: true + stale-issue-age: + description: 'Number of days of inactivity before marking an issue as stale' + required: true + default: '180' + close-message: + description: 'Message to post when closing a stale issue' + required: true + default: 'This issue was closed due to 7 days of inactivity after being marked as stale. Feel free to reopen it if it remains relevant.' + stale-issue-label: + description: 'Label to apply to stale issues' + required: true + default: 'stale' + exempt-issue-labels: + description: 'Comma-separated list of labels to exempt from staleness check' + required: false + default: 'feature request,question' + days-before-close: + description: 'Number of days after being marked stale before closing' + required: true + default: '7' + ascending: + description: 'Whether to process issues in ascending order of creation date.' + required: false + default: 'true' + operations-per-run: + description: 'Maximum number of operations per run.' + required: false + default: '30' +outputs: + closed-count: + description: 'The number of issues closed' +runs: + using: 'composite' + steps: + - name: Close Stale Issues + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.github-token }} + STALE_ISSUE_AGE: ${{ inputs.stale-issue-age }} + CLOSE_MESSAGE: ${{ inputs.close-message }} + EXEMPT_ISSUE_LABELS: ${{ inputs.exempt-labels }} + STALE_ISSUE_LABEL: ${{ inputs.stale-issue-label }} + DAYS_BEFORE_CLOSE: ${{ inputs.days-before-close }} + ASCENDING: ${{ inputs.ascending }} + OPERATIONS_PER_RUN: ${{ inputs.operations-per-run }} + run: | + # Script to close stale issues + set -euo pipefail + # Default values + stale_issue_age=$STALE_ISSUE_AGE + close_message="$CLOSE_MESSAGE" + exempt_labels="$EXEMPT_ISSUE_LABELS" + github_token="$GITHUB_TOKEN" + stale_issue_label="$STALE_ISSUE_LABEL" + days_before_close=$DAYS_BEFORE_CLOSE + ascending=$ASCENDING + operations_per_run=$OPERATIONS_PER_RUN + closed_count=0 + # Function to log messages + log_info() { + echo "[INFO] $1" + } + log_error() { + echo "[ERROR] $1" >&2 + } + if [[ -z "$github_token" ]]; then + log_error "GitHub token is required." + exit 1 + fi + if [[ -z "$stale_issue_age" || ! [[ "$stale_issue_age" =~ ^[0-9]+$ ]] ]]; then + log_error "Stale issue age must be a positive number." + exit 1 + fi + if [[ -z "$days_before_close" || ! [[ "$days_before_close" =~ ^[0-9]+$ ]] ]]; then + log_error "Days before close must be a positive number." + exit 1 + fi + if [[ -z "$operations_per_run" || ! [[ "$operations_per_run" =~ ^[0-9]+$ ]] ]]; then + log_error "Operations per run must be a positive number." + exit 1 + fi + # GitHub API endpoint + api_url="https://api.github.com/repos/${GITHUB_REPOSITORY}/issues" + # Function to fetch issues + fetch_issues() { + page="$1" + sort_order="updated" + if [[ "$ascending" == "true" ]]; then + sort_direction="asc" + else + sort_direction="desc" + fi + curl -sS -H "Authorization: token $github_token" \ + -H "Accept: application/vnd.github.v3+json" \ + "$api_url?state=open&sort=$sort_order&direction=$sort_direction&per_page=100&page=$page" | + jq -r '.[] | { number: .number, updated_at: .updated_at, labels: [.labels[].name] }' | + while IFS= read -r issue_data; do + echo "$issue_data" + done + } + # Function to check if an issue is stale + is_stale() { + local issue_updated_at="$1" + local issue_number="$2" + # Get the current date in seconds since the epoch + current_time=$(date +%s) + # Convert the issue's updated_at time to seconds since the epoch + issue_updated_time=$(date -d "$issue_updated_at" +%s) + # Calculate the difference in seconds + diff=$((current_time - issue_updated_time)) + # Calculate the staleness threshold in seconds + stale_threshold=$((stale_issue_age * 24 * 60 * 60)) + if ((diff > stale_threshold)); then + log_info "Issue #$issue_number is stale (updated at: $issue_updated_at, stale age: $stale_issue_age days)." + return 0 # Return 0 if stale + else + log_info "Issue #$issue_number is not stale (updated at: $issue_updated_at, stale age: $stale_issue_age days)." + return 1 # Return 1 if not stale + fi + } + # Function to check if an issue is exempt + is_exempt() { + local issue_labels=("$@") + local exempt_labels_list=($(echo "$exempt_labels" | tr ',' ' ')) + if [[ -n "$exempt_labels" ]]; then + for exempt_label in "${exempt_labels_list[@]}"; do + for issue_label in "${issue_labels[@]}"; do + if [[ "$issue_label" == "$exempt_label" ]]; then + log_info "Issue #$issue_number is exempt from staleness check due to label: $issue_label" + return 0 # Return 0 if exempt + fi + done + done + fi + return 1 # Return 1 if not exempt + } + # Function to close an issue + close_issue() { + local issue_number="$1" + local close_message="$2" + log_info "Closing issue #$issue_number with message: '$close_message'" + curl -sS -X POST \ + -H "Authorization: token $github_token" \ + -H "Accept: application/vnd.github.v3+json" \ + "$api_url/$issue_number" \ + -d "{\"state\": \"closed\", \"body\": \"$close_message\"}" + if [ $? -eq 0 ]; then + ((closed_count++)) + log_info "Issue #$issue_number closed successfully." + else + log_error "Failed to close issue #$issue_number" + fi + } + # Main script logic + log_info "Checking for stale issues in repository: $GITHUB_REPOSITORY" + page=1 + processed_count=0 + while true; do + issues=$(fetch_issues "$page") + if [[ -z "$issues" ]]; then + log_info "No more issues to process." + break + fi + # Process each issue + IFS=$'\n' read -rd '' -a issue_array <<< "$issues" + for issue_data in "${issue_array[@]}"; do + # Parse the JSON data + issue_number=$(echo "$issue_data" | jq -r '.number') + updated_at=$(echo "$issue_data" | jq -r '.updated_at') + issue_labels=($(echo "$issue_data" | jq -r '.labels[]')) + if is_exempt "${issue_labels[@]}"; then + continue + fi + if is_stale "$updated_at" "$issue_number"; then + close_issue "$issue_number" "$close_message" + fi + ((processed_count++)) + if [[ "$processed_count" -ge "$operations_per_run" ]]; then + log_info "Reached the maximum number of operations ($operations_per_run) for this run." + break + fi + done + if [[ "$processed_count" -ge "$operations_per_run" ]]; then + break + fi + page=$((page + 1)) + done + echo "::set-output name=closed-count::$closed_count" + log_info "Stale issue check complete. Closed $closed_count issues." -on: - workflow_call: - inputs: - operations-per-run: - description: 'Number of operations per run' - required: false - default: '30' - secrets: - repo-token: - description: 'GitHub token used to authenticate and modify issues' - required: true - -jobs: - monitor-issues: - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - uses: actions/stale@v9 - with: - exempt-issue-labels: 'feature request,question' - days-before-issue-stale: 0 - days-before-issue-close: 0 - stale-issue-label: "stale" - stale-issue-message: "This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days" - close-issue-message: "This issue was closed due to 7 days of inactivity after being marked as stale. Feel free to reopen it if it remains relevant." - days-before-pr-close: false - days-before-pr-stale: false - ascending: true - operations-per-run: ${{ inputs.operations-per-run }} - repo-token: ${{ secrets.repo-token }} diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index dba5fcb..0414136 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -1,18 +1,27 @@ -name: Test Monitor Issues - +name: 'Close Stale Issues' on: - workflow_dispatch: + schedule: + - cron: '0 0 * * *' # Run daily at midnight UTC + workflow_dispatch: # Allows manual triggering inputs: operations-per-run: - description: 'Number of operations per run' + description: 'Maximum number of operations per run' required: false default: '30' - schedule: - - cron: "0 0 * * *" # Runs once a day at midnigh - jobs: - workflow_call_1: - uses: reshmifrog/.github/actions/monitor-issues@feature/monitor-issues-reusable - with: - repo-token: ${{ secrets.REPO_TOKEN }} - operations-per-run: 30 + close-stale: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/close-stale-issues@v1 # Use a specific version tag for stability + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-age: 180 + close-message: 'This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days.' + stale-issue-label: 'stale' + exempt-issue-labels: 'feature request,question' + days-before-close: 7 + ascending: true + operations-per-run: ${{ github.event.inputs.operations-per-run || 30 }} From 6395bf04def814be60b218985b755bc807b61540 Mon Sep 17 00:00:00 2001 From: Reshmi Date: Tue, 29 Apr 2025 15:29:49 +0530 Subject: [PATCH 15/21] redcued days for stale --- .github/workflows/test-monitor-issues.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 0414136..b9a7bcb 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -18,10 +18,10 @@ jobs: - uses: ./.github/actions/close-stale-issues@v1 # Use a specific version tag for stability with: github-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-age: 180 + stale-issue-age: 0 close-message: 'This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days.' stale-issue-label: 'stale' exempt-issue-labels: 'feature request,question' - days-before-close: 7 + days-before-close: 0 ascending: true operations-per-run: ${{ github.event.inputs.operations-per-run || 30 }} From 279d6fdfd13f97ae98870651d7e511b7ab4dc97a Mon Sep 17 00:00:00 2001 From: Reshmi Date: Tue, 29 Apr 2025 15:42:45 +0530 Subject: [PATCH 16/21] added to check workflow --- .github/workflows/simple_workflow_dispatch.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .github/workflows/simple_workflow_dispatch.yml diff --git a/.github/workflows/simple_workflow_dispatch.yml b/.github/workflows/simple_workflow_dispatch.yml new file mode 100644 index 0000000..be5d679 --- /dev/null +++ b/.github/workflows/simple_workflow_dispatch.yml @@ -0,0 +1,3 @@ +name: Simple Workflow Dispatch +on: + workflow_dispatch: \ No newline at end of file From f1678b713ce8c3186c0c739bfc618199d94078c2 Mon Sep 17 00:00:00 2001 From: Reshmi Date: Tue, 29 Apr 2025 16:16:43 +0530 Subject: [PATCH 17/21] fixed issue with lable name --- .github/actions/monitor-issues/action.yml | 4 ++-- .github/workflows/test-monitor-issues.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/monitor-issues/action.yml b/.github/actions/monitor-issues/action.yml index 1a07702..93d2cf8 100644 --- a/.github/actions/monitor-issues/action.yml +++ b/.github/actions/monitor-issues/action.yml @@ -44,7 +44,7 @@ runs: GITHUB_TOKEN: ${{ inputs.github-token }} STALE_ISSUE_AGE: ${{ inputs.stale-issue-age }} CLOSE_MESSAGE: ${{ inputs.close-message }} - EXEMPT_ISSUE_LABELS: ${{ inputs.exempt-labels }} + EXEMPT_ISSUE_LABELS: ${{ inputs.exempt-issue-labels }} STALE_ISSUE_LABEL: ${{ inputs.stale-issue-label }} DAYS_BEFORE_CLOSE: ${{ inputs.days-before-close }} ASCENDING: ${{ inputs.ascending }} @@ -191,6 +191,6 @@ runs: fi page=$((page + 1)) done - echo "::set-output name=closed-count::$closed_count" + echo "closed-count=$closed_count" >> $GITHUB_OUTPUT log_info "Stale issue check complete. Closed $closed_count issues." diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index b9a7bcb..772e966 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -2,7 +2,7 @@ name: 'Close Stale Issues' on: schedule: - cron: '0 0 * * *' # Run daily at midnight UTC - workflow_dispatch: # Allows manual triggering + workflow_dispatch: inputs: operations-per-run: description: 'Maximum number of operations per run' @@ -15,7 +15,7 @@ jobs: issues: write steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/close-stale-issues@v1 # Use a specific version tag for stability + - uses: ./.github/actions/close-stale-issues with: github-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-age: 0 From bd7d629eb1db88bef5ca6d2b277e6050722d989b Mon Sep 17 00:00:00 2001 From: Reshmi Date: Tue, 29 Apr 2025 16:21:44 +0530 Subject: [PATCH 18/21] updated workflow --- .github/workflows/simple_workflow_dispatch.yml | 3 --- .github/workflows/test-monitor-issues.yml | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 .github/workflows/simple_workflow_dispatch.yml diff --git a/.github/workflows/simple_workflow_dispatch.yml b/.github/workflows/simple_workflow_dispatch.yml deleted file mode 100644 index be5d679..0000000 --- a/.github/workflows/simple_workflow_dispatch.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: Simple Workflow Dispatch -on: - workflow_dispatch: \ No newline at end of file diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 772e966..8812d88 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -14,8 +14,7 @@ jobs: permissions: issues: write steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/close-stale-issues + - uses: reshmifrog/.github/actions/monitor-issues@feature/monitor-issues-reusable with: github-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-age: 0 From 1dc1a1f1ab68e77817e3b951ab0e897250b3cf5a Mon Sep 17 00:00:00 2001 From: Reshmi Date: Tue, 29 Apr 2025 16:24:29 +0530 Subject: [PATCH 19/21] updated --- .github/workflows/test-monitor-issues.yml | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/test-monitor-issues.yml index 8812d88..166911a 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/test-monitor-issues.yml @@ -1,3 +1,27 @@ +#name: 'Close Stale Issues' +#on: # Run daily at midnight UTC +# workflow_dispatch: +# inputs: +# operations-per-run: +# description: 'Maximum number of operations per run' +# required: false +# default: '30' +#jobs: +# close-stale: +# runs-on: ubuntu-latest +# permissions: +# issues: write +# steps: +# - uses: reshmifrog/.github/actions/monitor-issues@feature/monitor-issues-reusable +# with: +# github-token: ${{ secrets.GITHUB_TOKEN }} +# stale-issue-age: 0 +# close-message: 'This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days.' +# stale-issue-label: 'stale' +# exempt-issue-labels: 'feature request,question' +# days-before-close: 0 +# ascending: true +# operations-per-run: ${{ github.event.inputs.operations-per-run || 30 }} name: 'Close Stale Issues' on: schedule: From fc236bff325434906b6895c6e2c7011ab52b1f4e Mon Sep 17 00:00:00 2001 From: Reshmi Date: Tue, 29 Apr 2025 16:32:46 +0530 Subject: [PATCH 20/21] renamed workflow file --- ...or-issues.yml => close-stale-workflow.yml} | 24 ------------------- 1 file changed, 24 deletions(-) rename .github/workflows/{test-monitor-issues.yml => close-stale-workflow.yml} (50%) diff --git a/.github/workflows/test-monitor-issues.yml b/.github/workflows/close-stale-workflow.yml similarity index 50% rename from .github/workflows/test-monitor-issues.yml rename to .github/workflows/close-stale-workflow.yml index 166911a..8812d88 100644 --- a/.github/workflows/test-monitor-issues.yml +++ b/.github/workflows/close-stale-workflow.yml @@ -1,27 +1,3 @@ -#name: 'Close Stale Issues' -#on: # Run daily at midnight UTC -# workflow_dispatch: -# inputs: -# operations-per-run: -# description: 'Maximum number of operations per run' -# required: false -# default: '30' -#jobs: -# close-stale: -# runs-on: ubuntu-latest -# permissions: -# issues: write -# steps: -# - uses: reshmifrog/.github/actions/monitor-issues@feature/monitor-issues-reusable -# with: -# github-token: ${{ secrets.GITHUB_TOKEN }} -# stale-issue-age: 0 -# close-message: 'This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days.' -# stale-issue-label: 'stale' -# exempt-issue-labels: 'feature request,question' -# days-before-close: 0 -# ascending: true -# operations-per-run: ${{ github.event.inputs.operations-per-run || 30 }} name: 'Close Stale Issues' on: schedule: From df9f8f4d330716dc6a388bfde1f0b7db735d81ee Mon Sep 17 00:00:00 2001 From: Reshmi Date: Tue, 29 Apr 2025 16:41:35 +0530 Subject: [PATCH 21/21] manual workflow trigger test --- .github/workflows/manual-test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/workflows/manual-test.yml diff --git a/.github/workflows/manual-test.yml b/.github/workflows/manual-test.yml new file mode 100644 index 0000000..3b794b8 --- /dev/null +++ b/.github/workflows/manual-test.yml @@ -0,0 +1,9 @@ +name: Test Manual Trigger Button +on: + workflow_dispatch: # Only this trigger + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: echo "Button test successful!" \ No newline at end of file