From a47b9c7d9e382598c264b79625496934415b7e4f Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 26 Jul 2023 10:39:56 -0600 Subject: [PATCH 01/11] Create comment.yml --- .github/workflows/comment.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/comment.yml diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml new file mode 100644 index 0000000..794be9f --- /dev/null +++ b/.github/workflows/comment.yml @@ -0,0 +1,33 @@ +name: Comment on Issues and Pull Requests +on: + issues: + types: [opened] + pull_request: + types: [opened] + +jobs: + comment-on-issues-and-pull-requests: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Comment on Issue or Pull Request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Add your custom comment message here + comment_message="Thank you for opening this issue/pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. All issues and pull requests will eventually be closed." + + # For Issues + if [ "${{ github.event_name }}" = "issues" ]; then + comment_url=$(jq -r .issue.comments_url "${{ github.event_path }}") + fi + + # For Pull Requests + if [ "${{ github.event_name }}" = "pull_request" ]; then + comment_url=$(jq -r .pull_request.comments_url "${{ github.event_path }}") + fi + + # Post the comment + curl -sSL -H "Authorization: token $GITHUB_TOKEN" -X POST -d "{\"body\":\"$comment_message\"}" "$comment_url" From bfd2129245467148a8cf019e1b1999e61890b6e1 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 26 Jul 2023 10:43:49 -0600 Subject: [PATCH 02/11] Create close.yml --- .github/workflows/close.yml | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/close.yml diff --git a/.github/workflows/close.yml b/.github/workflows/close.yml new file mode 100644 index 0000000..6556cba --- /dev/null +++ b/.github/workflows/close.yml @@ -0,0 +1,44 @@ +name: Close Stale Issues and Pull Requests +on: + schedule: + # Set the interval for running the workflow (e.g., every day) + - cron: "0 0 1,15 * *" + +jobs: + close-stale-issues-and-pull-requests: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Close Stale Issues and Pull Requests + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Define the number of days of inactivity after which issues/pull requests will be considered stale + stale_days=30 + + # Get the current date in ISO 8601 format + current_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + + # For Issues + issues=$(curl -sSL -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/issues?state=open") + for issue in $(echo "${issues}" | jq -r '.[] | @base64'); do + issue_date=$(echo "$issue" | base64 --decode | jq -r '.created_at') + days_since_issue=$(( ($(date -d "${current_date}" +%s) - $(date -d "${issue_date}" +%s)) / 86400 )) + if [ $days_since_issue -ge $stale_days ]; then + issue_number=$(echo "$issue" | base64 --decode | jq -r '.number') + curl -sSL -H "Authorization: token $GITHUB_TOKEN" -X POST -d "{\"state\":\"closed\"}" "https://api.github.com/repos/${{ github.repository }}/issues/$issue_number/comments" + fi + done + + # For Pull Requests + pull_requests=$(curl -sSL -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/pulls?state=open") + for pr in $(echo "${pull_requests}" | jq -r '.[] | @base64'); do + pr_date=$(echo "$pr" | base64 --decode | jq -r '.created_at') + days_since_pr=$(( ($(date -d "${current_date}" +%s) - $(date -d "${pr_date}" +%s)) / 86400 )) + if [ $days_since_pr -ge $stale_days ]; then + pr_number=$(echo "$pr" | base64 --decode | jq -r '.number') + curl -sSL -H "Authorization: token $GITHUB_TOKEN" -X POST -d "{\"state\":\"closed\"}" "https://api.github.com/repos/${{ github.repository }}/pulls/$pr_number/comments" + fi + done From f7dd8eac20a6210109eae8214a890bcab1290ddf Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 26 Jul 2023 14:12:25 -0600 Subject: [PATCH 03/11] Delete comment.yml --- .github/workflows/comment.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 .github/workflows/comment.yml diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml deleted file mode 100644 index 794be9f..0000000 --- a/.github/workflows/comment.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Comment on Issues and Pull Requests -on: - issues: - types: [opened] - pull_request: - types: [opened] - -jobs: - comment-on-issues-and-pull-requests: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Comment on Issue or Pull Request - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Add your custom comment message here - comment_message="Thank you for opening this issue/pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. All issues and pull requests will eventually be closed." - - # For Issues - if [ "${{ github.event_name }}" = "issues" ]; then - comment_url=$(jq -r .issue.comments_url "${{ github.event_path }}") - fi - - # For Pull Requests - if [ "${{ github.event_name }}" = "pull_request" ]; then - comment_url=$(jq -r .pull_request.comments_url "${{ github.event_path }}") - fi - - # Post the comment - curl -sSL -H "Authorization: token $GITHUB_TOKEN" -X POST -d "{\"body\":\"$comment_message\"}" "$comment_url" From eb0c8fdb14b644f28a48e50d2468c4c03630a2a9 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 26 Jul 2023 14:18:47 -0600 Subject: [PATCH 04/11] use stale action --- .github/workflows/close.yml | 44 ------------------------------------- .github/workflows/stale.yml | 17 ++++++++++++++ 2 files changed, 17 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/close.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/close.yml b/.github/workflows/close.yml deleted file mode 100644 index 6556cba..0000000 --- a/.github/workflows/close.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Close Stale Issues and Pull Requests -on: - schedule: - # Set the interval for running the workflow (e.g., every day) - - cron: "0 0 1,15 * *" - -jobs: - close-stale-issues-and-pull-requests: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Close Stale Issues and Pull Requests - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Define the number of days of inactivity after which issues/pull requests will be considered stale - stale_days=30 - - # Get the current date in ISO 8601 format - current_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - - # For Issues - issues=$(curl -sSL -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/issues?state=open") - for issue in $(echo "${issues}" | jq -r '.[] | @base64'); do - issue_date=$(echo "$issue" | base64 --decode | jq -r '.created_at') - days_since_issue=$(( ($(date -d "${current_date}" +%s) - $(date -d "${issue_date}" +%s)) / 86400 )) - if [ $days_since_issue -ge $stale_days ]; then - issue_number=$(echo "$issue" | base64 --decode | jq -r '.number') - curl -sSL -H "Authorization: token $GITHUB_TOKEN" -X POST -d "{\"state\":\"closed\"}" "https://api.github.com/repos/${{ github.repository }}/issues/$issue_number/comments" - fi - done - - # For Pull Requests - pull_requests=$(curl -sSL -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/pulls?state=open") - for pr in $(echo "${pull_requests}" | jq -r '.[] | @base64'); do - pr_date=$(echo "$pr" | base64 --decode | jq -r '.created_at') - days_since_pr=$(( ($(date -d "${current_date}" +%s) - $(date -d "${pr_date}" +%s)) / 86400 )) - if [ $days_since_pr -ge $stale_days ]; then - pr_number=$(echo "$pr" | base64 --decode | jq -r '.number') - curl -sSL -H "Authorization: token $GITHUB_TOKEN" -X POST -d "{\"state\":\"closed\"}" "https://api.github.com/repos/${{ github.repository }}/pulls/$pr_number/comments" - fi - done diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..c36b614 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,17 @@ +name: 'Close stale issues and PR' +on: + schedule: + - cron: '0 0 1 * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v8 + with: + stale-issue-message: 'Thank you for opening this issue! This is a sandbox repository for you to practice working with GitHub and practice issues will be closed once stale. This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your issue requires attention, please tag the `@ProjectPythia` team.' + stale-pr-message: 'Thank you for opening this pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. This is pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your pull request requires attention, please tag the `@ProjectPythia` team.' + close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' + days-before-stale: 30 + days-before-close: 5 + days-before-pr-close: 5 From a529d39497a23d59a920d65e0f8021688be6fbc8 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:03:00 -0600 Subject: [PATCH 05/11] Update .github/workflows/stale.yml Co-authored-by: Brian Rose --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index c36b614..2214d75 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/stale@v8 with: stale-issue-message: 'Thank you for opening this issue! This is a sandbox repository for you to practice working with GitHub and practice issues will be closed once stale. This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your issue requires attention, please tag the `@ProjectPythia` team.' - stale-pr-message: 'Thank you for opening this pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. This is pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your pull request requires attention, please tag the `@ProjectPythia` team.' + stale-pr-message: 'Thank you for opening this pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. This is pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your pull request requires attention, please tag the `@ProjectPythia/infrastructure` team.' close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' days-before-stale: 30 days-before-close: 5 From 86fa4675c030af50ca505fe16ecc99d1d20ff037 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:06:37 -0600 Subject: [PATCH 06/11] Update .github/workflows/stale.yml Co-authored-by: Brian Rose --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 2214d75..2c03faa 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/stale@v8 with: - stale-issue-message: 'Thank you for opening this issue! This is a sandbox repository for you to practice working with GitHub and practice issues will be closed once stale. This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your issue requires attention, please tag the `@ProjectPythia` team.' + stale-issue-message: 'Thank you for opening this issue! This is a sandbox repository for you to practice working with GitHub and practice issues will be closed once stale. This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your issue requires attention, please tag the `@ProjectPythia/infrastructure` team.' stale-pr-message: 'Thank you for opening this pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. This is pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your pull request requires attention, please tag the `@ProjectPythia/infrastructure` team.' close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' days-before-stale: 30 From 4ef5a16d88a79f1624d89714fee4ff349f745de8 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:18:50 -0600 Subject: [PATCH 07/11] Create comment.yml --- .github/workflows/comment.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/comment.yml diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml new file mode 100644 index 0000000..72504f7 --- /dev/null +++ b/.github/workflows/comment.yml @@ -0,0 +1,15 @@ +on: pull_request + +jobs: + example_comment_pr: + runs-on: ubuntu-latest + name: An example job to comment a PR + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Comment PR + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + Thank you for your pull request! As this is a sandbox repository, your pull request will eventually be closed. If you would like engagement from the Pythia team on this, please tag @ProjectPythia/infrastructure to let us know! From 330a26049ec403774726bd47ea70c50a2efa8d4b Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:19:26 -0600 Subject: [PATCH 08/11] Update comment.yml --- .github/workflows/comment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml index 72504f7..2d0c65e 100644 --- a/.github/workflows/comment.yml +++ b/.github/workflows/comment.yml @@ -12,4 +12,4 @@ jobs: uses: thollander/actions-comment-pull-request@v2 with: message: | - Thank you for your pull request! As this is a sandbox repository, your pull request will eventually be closed. If you would like engagement from the Pythia team on this, please tag @ProjectPythia/infrastructure to let us know! + Thank you for your pull request! As this is a sandbox repository, your pull request will eventually be closed. If you would like engagement from the Pythia team on this, please tag `@ProjectPythia/infrastructure` to let us know! From c4d6a5055604ad669d18dc6d624e1dbfd4929f6a Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 27 Jul 2023 14:07:06 -0600 Subject: [PATCH 09/11] rm tag from comment.yml --- .github/workflows/comment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml index 2d0c65e..36ff4d2 100644 --- a/.github/workflows/comment.yml +++ b/.github/workflows/comment.yml @@ -12,4 +12,4 @@ jobs: uses: thollander/actions-comment-pull-request@v2 with: message: | - Thank you for your pull request! As this is a sandbox repository, your pull request will eventually be closed. If you would like engagement from the Pythia team on this, please tag `@ProjectPythia/infrastructure` to let us know! + Thank you for your pull request! As this is a sandbox repository, your pull request will eventually be closed. From 16f11bdabc497e075efac0ba1f929f9fd164fd2d Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 27 Jul 2023 14:07:47 -0600 Subject: [PATCH 10/11] Update stale.yml to rm tag --- .github/workflows/stale.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 2c03faa..1611b2d 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -9,8 +9,8 @@ jobs: steps: - uses: actions/stale@v8 with: - stale-issue-message: 'Thank you for opening this issue! This is a sandbox repository for you to practice working with GitHub and practice issues will be closed once stale. This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your issue requires attention, please tag the `@ProjectPythia/infrastructure` team.' - stale-pr-message: 'Thank you for opening this pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. This is pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. If this is in error and your pull request requires attention, please tag the `@ProjectPythia/infrastructure` team.' + stale-issue-message: 'Thank you for opening this issue! This is a sandbox repository for you to practice working with GitHub and practice issues will be closed once stale. This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + stale-pr-message: 'Thank you for opening this pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. This is pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' days-before-stale: 30 days-before-close: 5 From 86003b3686f90e0a944d3d1382606470a529014f Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 27 Jul 2023 14:37:25 -0600 Subject: [PATCH 11/11] Update .github/workflows/stale.yml Co-authored-by: Brian Rose --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 1611b2d..2a8c92c 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/stale@v8 with: stale-issue-message: 'Thank you for opening this issue! This is a sandbox repository for you to practice working with GitHub and practice issues will be closed once stale. This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' - stale-pr-message: 'Thank you for opening this pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. This is pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + stale-pr-message: 'Thank you for opening this pull request! This is a sandbox repository for you to practice working with GitHub. In interest of keeping this learning resource static for future users, your changes will not be incorporated. This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' days-before-stale: 30 days-before-close: 5