Reworked to use a custom token.
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 38s
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 38s
This commit is contained in:
parent
79f76b65f8
commit
1fd23b6ede
@ -23,37 +23,37 @@ jobs:
|
|||||||
branch: update/pre-commit-hooks
|
branch: update/pre-commit-hooks
|
||||||
push_options: --force
|
push_options: --force
|
||||||
create_branch: true
|
create_branch: true
|
||||||
- run: |
|
# - run: |
|
||||||
curl -X 'POST' \
|
# curl -X 'POST' \
|
||||||
'https://git.horstenkamp.eu/api/v1/repos/Philipp/gitea-act-create-pr/pulls' \
|
# 'https://git.horstenkamp.eu/api/v1/repos/Philipp/gitea-act-create-pr/pulls' \
|
||||||
-H 'accept: application/json' \
|
# -H 'accept: application/json' \
|
||||||
-H 'authorization: Basic cGhpbGlwcDphc2ZqSMKnMzg5SjhmSzM=' \
|
# -H 'authorization: Basic cGhpbGlwcDphc2ZqSMKnMzg5SjhmSzM=' \
|
||||||
-H 'Content-Type: application/json' \
|
# -H 'Content-Type: application/json' \
|
||||||
-d '{
|
# -d '{
|
||||||
"base": "main",
|
# "base": "main",
|
||||||
"body": "string",
|
# "body": "string",
|
||||||
"head": "update/pre-commit-hooks",
|
# "head": "update/pre-commit-hooks",
|
||||||
"title": "Some title"
|
# "title": "Some title"
|
||||||
}'
|
# }'
|
||||||
- name: Make a curl request
|
# - name: Make a curl request
|
||||||
env:
|
# env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
# run: |
|
||||||
curl -X 'POST' \
|
# curl -X 'POST' \
|
||||||
'https://git.horstenkamp.eu/api/v1/repos/Philipp/gitea-act-create-pr/pulls' \
|
# 'https://git.horstenkamp.eu/api/v1/repos/Philipp/gitea-act-create-pr/pulls' \
|
||||||
-H 'accept: application/json' \
|
# -H 'accept: application/json' \
|
||||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
# -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
-H 'Content-Type: application/json' \
|
# -H 'Content-Type: application/json' \
|
||||||
-d '{
|
# -d '{
|
||||||
"base": "main",
|
# "base": "main",
|
||||||
"body": "string",
|
# "body": "string",
|
||||||
"head": "update/pre-commit-hooks",
|
# "head": "update/pre-commit-hooks",
|
||||||
"title": "Some title"
|
# "title": "Some title"
|
||||||
}'
|
# }'
|
||||||
- name: My PR action
|
- name: My PR action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.REPO_TOKEN }}
|
||||||
branch: update/pre-commit-hooks
|
branch: update/pre-commit-hooks
|
||||||
title: My PR Title
|
title: My PR Title
|
||||||
body: My PR Body
|
body: My PR Body
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
name: Create PR if not exists
|
name: Create PR if not exists
|
||||||
description: Creates a pull request for a branch if it does not already exist
|
description: Creates a pull request for a branch if it does not already exist
|
||||||
inputs:
|
inputs:
|
||||||
github_token:
|
token:
|
||||||
description: GitHub token for authentication
|
description: Token for authentication. Github Token will not work.
|
||||||
required: false
|
required: false
|
||||||
branch:
|
branch:
|
||||||
description: Branch for which to create the PR
|
description: Branch for which to create the PR
|
||||||
|
6
index.js
6
index.js
@ -17,7 +17,7 @@ async function getAndPostPullRequests() {
|
|||||||
const labelsInput = core.getInput("labels");
|
const labelsInput = core.getInput("labels");
|
||||||
const dueDate = core.getInput("due_date");
|
const dueDate = core.getInput("due_date");
|
||||||
const milestone = core.getInput("milestone");
|
const milestone = core.getInput("milestone");
|
||||||
const githubToken = core.getInput("github_token");
|
const token = core.getInput("token");
|
||||||
let branch = core.getInput("branch");
|
let branch = core.getInput("branch");
|
||||||
|
|
||||||
// Construct the URL for the requests
|
// Construct the URL for the requests
|
||||||
@ -25,10 +25,10 @@ async function getAndPostPullRequests() {
|
|||||||
|
|
||||||
// Headers with Authorization
|
// Headers with Authorization
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `token ${githubToken}`,
|
Authorization: `token ${token}`,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
};
|
};
|
||||||
core.info(`token ${githubToken}`);
|
core.info(`token ${token}`);
|
||||||
// Logic for current branch
|
// Logic for current branch
|
||||||
if (!branch) {
|
if (!branch) {
|
||||||
const ref = process.env.GITHUB_REF;
|
const ref = process.env.GITHUB_REF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user