fixed-an-action (#20)
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 31s
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 31s
Reworked the action to include an pass for the 409 error. Reviewed-on: #20 Co-authored-by: Philipp Horstenkamp <philipp@horstenkamp.de> Co-committed-by: Philipp Horstenkamp <philipp@horstenkamp.de>
This commit is contained in:
parent
1c9d3972a7
commit
0f97b36198
@ -3,6 +3,9 @@ name: Auto Maintenance Cycle
|
||||
on:
|
||||
schedule:
|
||||
- cron: 0 1 * * *
|
||||
push:
|
||||
paths:
|
||||
- .gitea/workflows/maintenance.yaml
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@ -17,7 +20,9 @@ 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
|
||||
with:
|
||||
commit_message: 'chore: update pre-commit hooks'
|
||||
@ -26,7 +31,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:
|
||||
@ -34,5 +39,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
|
||||
reviewers: Philipp
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -189,4 +189,3 @@ replay_pid*
|
||||
# ---> PuTTY
|
||||
# Private key
|
||||
*.ppk
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
exclude: ^node_modules/
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
@ -34,7 +35,7 @@ repos:
|
||||
args: [--autofix]
|
||||
|
||||
- repo: https://github.com/frnmst/md-toc
|
||||
rev: 8.2.2
|
||||
rev: 8.2.0
|
||||
hooks:
|
||||
- id: md-toc
|
||||
|
||||
|
@ -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
|
||||
|
13
index.js
13
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,
|
||||
};
|
||||
@ -53,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}`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user