Updates to the pre-commit action created at 2023-11-24 #19
@ -3,6 +3,9 @@ name: Auto Maintenance Cycle
|
|||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: 0 1 * * *
|
- cron: 0 1 * * *
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- .gitea/workflows/maintenance.yaml
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -17,7 +20,9 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- run: pre-commit autoupdate
|
- run: pre-commit autoupdate
|
||||||
shell: bash
|
shell: bash
|
||||||
|
- run: pre-commit run -a
|
||||||
- name: Commit
|
- name: Commit
|
||||||
|
id: auto-commit-action
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
commit_message: 'chore: update pre-commit hooks'
|
commit_message: 'chore: update pre-commit hooks'
|
||||||
@ -26,7 +31,7 @@ jobs:
|
|||||||
create_branch: true
|
create_branch: true
|
||||||
- name: Generate Date
|
- name: Generate Date
|
||||||
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
|
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'
|
if: steps.auto-commit-action.outputs.changes_detected == 'true'
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@ -34,5 +39,3 @@ jobs:
|
|||||||
branch: update/pre-commit-hooks
|
branch: update/pre-commit-hooks
|
||||||
title: Updates to the pre-commit action created at ${{ env.CURRENT_DATE }}
|
title: Updates to the pre-commit action created at ${{ env.CURRENT_DATE }}
|
||||||
body: Update to the pre-commit action.
|
body: Update to the pre-commit action.
|
||||||
assignees: Philipp
|
|
||||||
reviewers: Philipp
|
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -189,4 +189,3 @@ replay_pid*
|
|||||||
# ---> PuTTY
|
# ---> PuTTY
|
||||||
# Private key
|
# Private key
|
||||||
*.ppk
|
*.ppk
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
exclude: ^node_modules/
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.5.0
|
rev: v4.5.0
|
||||||
|
@ -7,9 +7,6 @@ inputs:
|
|||||||
branch:
|
branch:
|
||||||
description: Branch for which to create the PR
|
description: Branch for which to create the PR
|
||||||
required: true
|
required: true
|
||||||
base_branch:
|
|
||||||
description: Branch in which should be mergbed. Defaults to main.
|
|
||||||
required: false
|
|
||||||
title:
|
title:
|
||||||
description: Title of the pull request
|
description: Title of the pull request
|
||||||
required: true
|
required: true
|
||||||
@ -17,6 +14,9 @@ inputs:
|
|||||||
description: Body of the pull request
|
description: Body of the pull request
|
||||||
required: false
|
required: false
|
||||||
default: Some default body!
|
default: Some default body!
|
||||||
|
base_branch:
|
||||||
|
description: Branch in which should be mergbed. Defaults to main.
|
||||||
|
required: false
|
||||||
assignees:
|
assignees:
|
||||||
description: Comma-separated list of assignees for the pull request
|
description: Comma-separated list of assignees for the pull request
|
||||||
required: false
|
required: false
|
||||||
|
13
index.js
13
index.js
@ -2,8 +2,6 @@ const core = require("@actions/core");
|
|||||||
|
|
||||||
async function getAndPostPullRequests() {
|
async function getAndPostPullRequests() {
|
||||||
try {
|
try {
|
||||||
core.info("Starting the action...");
|
|
||||||
|
|
||||||
// Retrieve inputs and token
|
// Retrieve inputs and token
|
||||||
const baseUrl = core.getInput("base_url") || "https://git.horstenkamp.eu";
|
const baseUrl = core.getInput("base_url") || "https://git.horstenkamp.eu";
|
||||||
const owner = core.getInput("owner") || process.env.GITHUB_REPOSITORY_OWNER;
|
const owner = core.getInput("owner") || process.env.GITHUB_REPOSITORY_OWNER;
|
||||||
@ -36,11 +34,11 @@ async function getAndPostPullRequests() {
|
|||||||
// Prepare POST data
|
// Prepare POST data
|
||||||
const postData = {
|
const postData = {
|
||||||
title: title,
|
title: title,
|
||||||
body: body,
|
body: body ? body : undefined,
|
||||||
head: branch,
|
head: branch,
|
||||||
base: base_branch,
|
base: base_branch,
|
||||||
assignees: assigneesInput ? assigneesInput.split(",") : [],
|
assignees: assigneesInput ? assigneesInput.split(",") : undefined,
|
||||||
reviewers: reviewersInput ? reviewersInput.split(",") : [],
|
reviewers: reviewersInput ? reviewersInput.split(",") : undefined,
|
||||||
due_date: dueDate || undefined,
|
due_date: dueDate || undefined,
|
||||||
milestone: milestone ? parseInt(milestone, 10) : 0,
|
milestone: milestone ? parseInt(milestone, 10) : 0,
|
||||||
};
|
};
|
||||||
@ -53,7 +51,10 @@ async function getAndPostPullRequests() {
|
|||||||
headers,
|
headers,
|
||||||
body: JSON.stringify(postData),
|
body: JSON.stringify(postData),
|
||||||
});
|
});
|
||||||
|
if (postResponse.status === 409) {
|
||||||
|
core.warning("PR between the branches already exists.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!postResponse.ok) {
|
if (!postResponse.ok) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`HTTP error! status on creating a new PR: ${postResponse.status}`,
|
`HTTP error! status on creating a new PR: ${postResponse.status}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user