baldm0mma/ add create-security-branch script

This commit is contained in:
jev forsberg
2025-05-29 16:48:57 -06:00
parent fa2aba1281
commit 1cb3e32433
2 changed files with 32 additions and 8 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
# Construct the security branch name
SECURITY_BRANCH="${INPUT_RELEASE_BRANCH}+security-${INPUT_SECURITY_BRANCH_NUMBER}"
# Check if branch already exists
if git show-ref --verify --quiet "refs/heads/${SECURITY_BRANCH}"; then
echo "::error::Security branch ${SECURITY_BRANCH} already exists"
exit 1
fi
# Create and push the new branch from the release branch
git checkout "${INPUT_RELEASE_BRANCH}"
git checkout -b "${SECURITY_BRANCH}"
git push origin "${SECURITY_BRANCH}"
# Output the branch name for the workflow
echo "branch=${SECURITY_BRANCH}" >> "${GITHUB_OUTPUT}"
+12 -8
View File
@@ -9,7 +9,8 @@ on:
security_branch_number:
type: string
description: 'The security branch number (e.g., 01)'
required: true
required: false
default: '01'
repository:
type: string
description: 'The repository to create the security branch in (e.g., grafana/grafana-security-mirror)'
@@ -27,7 +28,8 @@ on:
security_branch_number:
type: string
description: 'The security branch number (e.g., 01)'
required: true
required: false
default: '01'
repository:
type: string
description: 'The repository to create the security branch in (e.g., grafana/grafana-security-mirror)'
@@ -67,9 +69,11 @@ jobs:
- name: Create security branch
id: branch
uses: grafana/grafana-github-actions-go/create-security-branch@main
with:
release_branch: ${{ inputs.release_branch }}
security_branch_number: ${{ inputs.security_branch_number }}
repository: ${{ inputs.repository }}
token: ${{ steps.generate_token.outputs.token }}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
INPUT_RELEASE_BRANCH: ${{ inputs.release_branch }}
INPUT_SECURITY_BRANCH_NUMBER: ${{ inputs.security_branch_number }}
INPUT_REPOSITORY: ${{ inputs.repository }}
run: |
chmod +x .github/scripts/create-security-branch.sh
.github/scripts/create-security-branch.sh