Reworked to use a custom token.
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 38s

This commit is contained in:
Philipp Horstenkamp 2023-11-19 21:55:08 +01:00
parent 79f76b65f8
commit 1fd23b6ede
Signed by: Philipp
GPG Key ID: DD53EAC36AFB61B4
3 changed files with 33 additions and 33 deletions

View File

@ -23,37 +23,37 @@ jobs:
branch: update/pre-commit-hooks
push_options: --force
create_branch: true
- run: |
curl -X 'POST' \
'https://git.horstenkamp.eu/api/v1/repos/Philipp/gitea-act-create-pr/pulls' \
-H 'accept: application/json' \
-H 'authorization: Basic cGhpbGlwcDphc2ZqSMKnMzg5SjhmSzM=' \
-H 'Content-Type: application/json' \
-d '{
"base": "main",
"body": "string",
"head": "update/pre-commit-hooks",
"title": "Some title"
}'
- name: Make a curl request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -X 'POST' \
'https://git.horstenkamp.eu/api/v1/repos/Philipp/gitea-act-create-pr/pulls' \
-H 'accept: application/json' \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H 'Content-Type: application/json' \
-d '{
"base": "main",
"body": "string",
"head": "update/pre-commit-hooks",
"title": "Some title"
}'
# - run: |
# curl -X 'POST' \
# 'https://git.horstenkamp.eu/api/v1/repos/Philipp/gitea-act-create-pr/pulls' \
# -H 'accept: application/json' \
# -H 'authorization: Basic cGhpbGlwcDphc2ZqSMKnMzg5SjhmSzM=' \
# -H 'Content-Type: application/json' \
# -d '{
# "base": "main",
# "body": "string",
# "head": "update/pre-commit-hooks",
# "title": "Some title"
# }'
# - name: Make a curl request
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# curl -X 'POST' \
# 'https://git.horstenkamp.eu/api/v1/repos/Philipp/gitea-act-create-pr/pulls' \
# -H 'accept: application/json' \
# -H "Authorization: token ${GITHUB_TOKEN}" \
# -H 'Content-Type: application/json' \
# -d '{
# "base": "main",
# "body": "string",
# "head": "update/pre-commit-hooks",
# "title": "Some title"
# }'
- name: My PR action
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.REPO_TOKEN }}
branch: update/pre-commit-hooks
title: My PR Title
body: My PR Body

View File

@ -1,8 +1,8 @@
name: Create PR if not exists
description: Creates a pull request for a branch if it does not already exist
inputs:
github_token:
description: GitHub token for authentication
token:
description: Token for authentication. Github Token will not work.
required: false
branch:
description: Branch for which to create the PR

View File

@ -17,7 +17,7 @@ async function getAndPostPullRequests() {
const labelsInput = core.getInput("labels");
const dueDate = core.getInput("due_date");
const milestone = core.getInput("milestone");
const githubToken = core.getInput("github_token");
const token = core.getInput("token");
let branch = core.getInput("branch");
// Construct the URL for the requests
@ -25,10 +25,10 @@ async function getAndPostPullRequests() {
// Headers with Authorization
const headers = {
Authorization: `token ${githubToken}`,
Authorization: `token ${token}`,
"Content-Type": "application/json",
};
core.info(`token ${githubToken}`);
core.info(`token ${token}`);
// Logic for current branch
if (!branch) {
const ref = process.env.GITHUB_REF;