From c9207e4247f0688c095cea0775a86d86ccca193c Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 28 Mar 2023 18:10:21 +0200 Subject: [PATCH 01/13] try pull request --- .github/workflows/blank.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 8ea44bd..e9f2f83 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -8,11 +8,18 @@ on: workflow_dispatch: +permissions: + contents: read # only for delete-branch option + #issues: write + pull-requests: write + jobs: - stale: + create-comment: runs-on: ubuntu-latest steps: - - uses: akv-platform/stale@v-sdolin/push-ref - with: - debug-only: true - delete-branch: true + - name: 'Create comment' + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + # curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/4/comments -d "{\"body\":\"$(date)\"}" + curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body","state":"closed","base":"master"}' From 7f6450aecd7f58ab273253c78c99d27b5ee303d8 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 28 Mar 2023 18:14:22 +0200 Subject: [PATCH 02/13] Update blank.yml --- .github/workflows/blank.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index e9f2f83..e87d69d 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -17,9 +17,9 @@ jobs: create-comment: runs-on: ubuntu-latest steps: - - name: 'Create comment' + - name: 'Close PR' env: GITHUB_TOKEN: ${{ github.token }} run: | # curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/4/comments -d "{\"body\":\"$(date)\"}" - curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body","state":"closed","base":"master"}' + curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body","state":"closed","base":"main"}' From f3038aa1ecfd1b556640d5e883221c0e25f5ae62 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 28 Mar 2023 18:31:26 +0200 Subject: [PATCH 03/13] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index e87d69d..7ef73eb 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -14,7 +14,7 @@ permissions: pull-requests: write jobs: - create-comment: + test-permissions: runs-on: ubuntu-latest steps: - name: 'Close PR' From fc81471fea9a67872d478970086e008bd64d97aa Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 28 Mar 2023 18:34:15 +0200 Subject: [PATCH 04/13] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 7ef73eb..9374afc 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -22,4 +22,4 @@ jobs: GITHUB_TOKEN: ${{ github.token }} run: | # curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/4/comments -d "{\"body\":\"$(date)\"}" - curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body","state":"closed","base":"main"}' + curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body 2","state":"closed","base":"main"}' From a6cdde9f2eedef20924e198f01480cf5474fe5c6 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 28 Mar 2023 19:05:52 +0200 Subject: [PATCH 05/13] Update blank.yml --- .github/workflows/blank.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 9374afc..3db27ce 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -17,9 +17,10 @@ jobs: test-permissions: runs-on: ubuntu-latest steps: - - name: 'Close PR' + - name: 'Delete branch' env: GITHUB_TOKEN: ${{ github.token }} run: | # curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/4/comments -d "{\"body\":\"$(date)\"}" - curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body 2","state":"closed","base":"main"}' + # curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body 2","state":"closed","base":"main"}' + curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/akv-demo/test-stale/git/refs/heads/2del From 544f287c24b9d788565c728e794e3e746a64497d Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 28 Mar 2023 19:08:25 +0200 Subject: [PATCH 06/13] contents: write --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 3db27ce..5cc7705 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -9,7 +9,7 @@ on: workflow_dispatch: permissions: - contents: read # only for delete-branch option + contents: write # only for delete-branch option #issues: write pull-requests: write From 00a7d9274b3f8c53b0e324d309550da95fbab5ae Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 28 Mar 2023 19:21:58 +0200 Subject: [PATCH 07/13] create comment --- .github/workflows/blank.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 5cc7705..81d6f79 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -9,7 +9,7 @@ on: workflow_dispatch: permissions: - contents: write # only for delete-branch option + #contents: write # only for delete-branch option #issues: write pull-requests: write @@ -17,10 +17,10 @@ jobs: test-permissions: runs-on: ubuntu-latest steps: - - name: 'Delete branch' + - name: 'create comment to PR' env: GITHUB_TOKEN: ${{ github.token }} run: | - # curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/4/comments -d "{\"body\":\"$(date)\"}" - # curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body 2","state":"closed","base":"main"}' - curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/akv-demo/test-stale/git/refs/heads/2del + # curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/2/comments -d "{\"body\":\"$(date)\"}" + # ull-requests: write curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body 2","state":"closed","base":"main"}' + # contents: write curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/akv-demo/test-stale/git/refs/heads/2del From 5fabafea9b5013b99a792d3ba1cae03ffe3c5bc1 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 28 Mar 2023 19:23:06 +0200 Subject: [PATCH 08/13] comment --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 81d6f79..abd2d3c 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -21,6 +21,6 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} run: | - # curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/2/comments -d "{\"body\":\"$(date)\"}" + curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/2/comments -d "{\"body\":\"$(date)\"}" # ull-requests: write curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body 2","state":"closed","base":"main"}' # contents: write curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/akv-demo/test-stale/git/refs/heads/2del From 54a53ba3e7902171a5fd54c2260479b90e1512e8 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Wed, 29 Mar 2023 19:32:51 +0200 Subject: [PATCH 09/13] Update blank.yml --- .github/workflows/blank.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index abd2d3c..760f92d 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -17,7 +17,17 @@ jobs: test-permissions: runs-on: ubuntu-latest steps: + - name: debug + uses: akv-demo/stale@permissions + with: + stale-pr-message: 'This PR is stale because it has been open for 45 days with no activity. Remove stale label or comment or this will be closed in 15 days.' + close-pr-message: 'This PR was closed because it has been stalled for 15 days with no activity.' + days-before-pr-stale: 30 + days-before-pr-close: 15 + delete-branch: true + - name: 'create comment to PR' + if: ${{ false }} env: GITHUB_TOKEN: ${{ github.token }} run: | From f92ba629ca92f5c2b4ade1bd7516dbf94f37d2a7 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Wed, 29 Mar 2023 19:35:47 +0200 Subject: [PATCH 10/13] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 760f92d..fc83117 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: debug - uses: akv-demo/stale@permissions + uses: akv-platform/stale@permissions with: stale-pr-message: 'This PR is stale because it has been open for 45 days with no activity. Remove stale label or comment or this will be closed in 15 days.' close-pr-message: 'This PR was closed because it has been stalled for 15 days with no activity.' From 0b2b62096a8b1c55f4d9f9a4a4c413f7031f9ab3 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Wed, 29 Mar 2023 19:41:03 +0200 Subject: [PATCH 11/13] Update blank.yml --- .github/workflows/blank.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index fc83117..bc167af 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -4,12 +4,11 @@ name: CI on: push: - pull_request: workflow_dispatch: permissions: - #contents: write # only for delete-branch option + contents: write # only for delete-branch option #issues: write pull-requests: write From f8d3b7bf7e90d4944c637a60743f39534157f5d8 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Wed, 29 Mar 2023 20:03:48 +0200 Subject: [PATCH 12/13] list all --- .github/workflows/blank.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index bc167af..e5cc8d0 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -17,6 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: debug + if: ${{ false }} uses: akv-platform/stale@permissions with: stale-pr-message: 'This PR is stale because it has been open for 45 days with no activity. Remove stale label or comment or this will be closed in 15 days.' @@ -26,10 +27,11 @@ jobs: delete-branch: true - name: 'create comment to PR' - if: ${{ false }} + if: ${{ true }} env: GITHUB_TOKEN: ${{ github.token }} run: | - curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/2/comments -d "{\"body\":\"$(date)\"}" + curl -L -X GET -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues" + # curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/2/comments -d "{\"body\":\"$(date)\"}" # ull-requests: write curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body 2","state":"closed","base":"main"}' # contents: write curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/akv-demo/test-stale/git/refs/heads/2del From a85109921970178d541a5d80cf1c622ffd0865c5 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Wed, 29 Mar 2023 20:07:07 +0200 Subject: [PATCH 13/13] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index e5cc8d0..287ef69 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -31,7 +31,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} run: | - curl -L -X GET -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues" + curl -L -X GET -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues # curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/issues/2/comments -d "{\"body\":\"$(date)\"}" # ull-requests: write curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/akv-demo/test-stale/pulls/2 -d '{"title":"new title","body":"updated body 2","state":"closed","base":"main"}' # contents: write curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/akv-demo/test-stale/git/refs/heads/2del