From b98d76adf694214aaae68d7b295cd5f0c6f90a40 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Fri, 24 Nov 2023 17:42:31 +0100 Subject: [PATCH 01/10] Update actions. --- .gitea/workflows/maintenance.yaml | 3 +++ action.yml | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index 2de1609..5455f99 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -3,6 +3,9 @@ name: Auto Maintenance Cycle on: schedule: - cron: 0 1 * * * + push: + paths: + - .gitea\workflows\maintenance.yaml workflow_dispatch: jobs: diff --git a/action.yml b/action.yml index 788485e..8d2b9b1 100644 --- a/action.yml +++ b/action.yml @@ -7,9 +7,6 @@ inputs: branch: description: Branch for which to create the PR required: true - base_branch: - description: Branch in which should be mergbed. Defaults to main. - required: false title: description: Title of the pull request required: true @@ -17,6 +14,9 @@ inputs: description: Body of the pull request required: false default: Some default body! + base_branch: + description: Branch in which should be mergbed. Defaults to main. + required: false assignees: description: Comma-separated list of assignees for the pull request required: false -- 2.47.2 From 0c2136821e2dd88e175f97cfb385514227d91792 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Fri, 24 Nov 2023 18:42:32 +0100 Subject: [PATCH 02/10] Reworked the trigger again. --- .gitea/workflows/maintenance.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index 5455f99..9f053f8 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -5,7 +5,7 @@ on: - cron: 0 1 * * * push: paths: - - .gitea\workflows\maintenance.yaml + - .gitea/workflows/maintenance.yaml workflow_dispatch: jobs: -- 2.47.2 From b41135c6ca1442ad5df78181328aac6b37fff815 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Fri, 24 Nov 2023 18:46:57 +0100 Subject: [PATCH 03/10] Downgraded the pre-commit-config for testing. --- .gitea/workflows/maintenance.yaml | 2 +- .pre-commit-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index 9f053f8..932d00c 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -29,7 +29,7 @@ jobs: create_branch: true - name: Generate Date run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - - name: Create an PR action + - name: Create an PR if: steps.auto-commit-action.outputs.changes_detected == 'true' uses: ./ with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 85cbd02..c3a9d43 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: args: [--autofix] - repo: https://github.com/frnmst/md-toc - rev: 8.2.2 + rev: 8.2.0 hooks: - id: md-toc -- 2.47.2 From bf8513aa808c3cd6eb5d6cf557fd49ccaa607bc3 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Fri, 24 Nov 2023 18:48:37 +0100 Subject: [PATCH 04/10] Added an id --- .gitea/workflows/maintenance.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index 932d00c..db440b4 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -21,6 +21,7 @@ jobs: - run: pre-commit autoupdate shell: bash - name: Commit + id: auto-commit-action uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: 'chore: update pre-commit hooks' -- 2.47.2 From bea30bdeb224b8cf2edaa44a51b32cb873debf31 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Fri, 24 Nov 2023 18:50:08 +0100 Subject: [PATCH 05/10] Removed the reviewer --- .gitea/workflows/maintenance.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index db440b4..9deca08 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -39,4 +39,3 @@ jobs: title: Updates to the pre-commit action created at ${{ env.CURRENT_DATE }} body: Update to the pre-commit action. assignees: Philipp - reviewers: Philipp -- 2.47.2 From 78127df1f46d372f3c2ed92ebde89487a51de85b Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Fri, 24 Nov 2023 18:51:08 +0100 Subject: [PATCH 06/10] Reworked the token again. --- .gitea/workflows/maintenance.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index 9deca08..4471d95 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -38,4 +38,3 @@ jobs: branch: update/pre-commit-hooks title: Updates to the pre-commit action created at ${{ env.CURRENT_DATE }} body: Update to the pre-commit action. - assignees: Philipp -- 2.47.2 From 54c224ef33961509cb56c162972ebbed8944f4e8 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Fri, 24 Nov 2023 19:01:41 +0100 Subject: [PATCH 07/10] Reworked the pushed response again. --- index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index a071824..30179e7 100644 --- a/index.js +++ b/index.js @@ -2,8 +2,6 @@ const core = require("@actions/core"); async function getAndPostPullRequests() { try { - core.info("Starting the action..."); - // Retrieve inputs and token const baseUrl = core.getInput("base_url") || "https://git.horstenkamp.eu"; const owner = core.getInput("owner") || process.env.GITHUB_REPOSITORY_OWNER; @@ -36,11 +34,11 @@ async function getAndPostPullRequests() { // Prepare POST data const postData = { title: title, - body: body, + body: body ? body : undefined, head: branch, base: base_branch, - assignees: assigneesInput ? assigneesInput.split(",") : [], - reviewers: reviewersInput ? reviewersInput.split(",") : [], + assignees: assigneesInput ? assigneesInput.split(",") : undefined, + reviewers: reviewersInput ? reviewersInput.split(",") : undefined, due_date: dueDate || undefined, milestone: milestone ? parseInt(milestone, 10) : 0, }; -- 2.47.2 From 220e001fd3b6fed69ce39234f6bb165d0d4d1943 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Fri, 24 Nov 2023 19:10:40 +0100 Subject: [PATCH 08/10] Added an warning on status code 409 --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 30179e7..dc77308 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,10 @@ async function getAndPostPullRequests() { headers, body: JSON.stringify(postData), }); - + if (postResponse.status === 409) { + core.warning("PR between the branches already exists."); + return; + } if (!postResponse.ok) { throw new Error( `HTTP error! status on creating a new PR: ${postResponse.status}`, -- 2.47.2 From 915e77b2b8c9f26f59d40841bafd3bb2ffdff18f Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Fri, 24 Nov 2023 19:15:23 +0100 Subject: [PATCH 09/10] Running pre-commit oer everything. --- .gitea/workflows/maintenance.yaml | 1 + .gitignore | 1 - .pre-commit-config.yaml | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index 4471d95..92bd9fd 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -20,6 +20,7 @@ jobs: shell: bash - run: pre-commit autoupdate shell: bash + - run: pre-commit run -a - name: Commit id: auto-commit-action uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.gitignore b/.gitignore index 053c255..a7014f8 100644 --- a/.gitignore +++ b/.gitignore @@ -189,4 +189,3 @@ replay_pid* # ---> PuTTY # Private key *.ppk - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c3a9d43..8512d09 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +exclude: ^node_modules/ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 -- 2.47.2 From 37562dad67633884a59c97f5484fd6c48f379aff Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 24 Nov 2023 18:16:14 +0000 Subject: [PATCH 10/10] chore: update pre-commit hooks --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8512d09..701e7c4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,7 +35,7 @@ repos: args: [--autofix] - repo: https://github.com/frnmst/md-toc - rev: 8.2.0 + rev: 8.2.2 hooks: - id: md-toc -- 2.47.2