Skip to content

Commit

Permalink
Add create release notes pr action
Browse files Browse the repository at this point in the history
  • Loading branch information
araratthehero committed Nov 18, 2024
1 parent 432f7f7 commit 5efb7de
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/create_release_notes_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Create release notes PR

on:
workflow_call:
inputs:
version-name:
required: true
type: string
release-notes:
required: true
type: string

jobs:
create_release_notes_pr:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Create release notes PR
env:
VERSION_NAME: ${{ inputs.version-name }}
RELEASE_NOTES: ${{ inputs.release-notes }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
run: |
# bash ./create-release-notes-pr.sh
# BASE_BRANCH="release-notes"
echo "Hello"
# RELEASE_NOTES_FILE="$VERSION_NAME.md"
#
# # Check out the base branch
# git fetch origin "$BASE_BRANCH"
# git checkout "$BASE_BRANCH"
#
# # Create and switch to the new branch
# git checkout -b "$VERSION_NAME"
#
# # Write the release notes to the file
# echo "$RELEASE_NOTES" > "$RELEASE_NOTES_FILE"
#
# # Add, commit, and push the changes
# git add "$RELEASE_NOTES_FILE"
# git commit -m "Add release notes for $VERSION_NAME release"
# git push origin "$VERSION_NAME"
#
# # Create a pull request using the GitHub API
# API_URL="https://api.github.com/repos/$GITHUB_REPO/pulls"
# PR_TITLE="Create release notes for $VERSION_NAME release"
# PR_BODY="This PR adds release notes for the $VERSION_NAME release."
# JSON_PAYLOAD=$(cat <<EOF {
# "title": "$PR_TITLE",
# "head": "$NEW_BRANCH",
# "base": "$BASE_BRANCH",
# "body": "$PR_BODY"
# }
# EOF)
#
# curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
# -H "Content-Type: application/json" \
# -d "$JSON_PAYLOAD" "$API_URL"
8 changes: 4 additions & 4 deletions .github/workflows/generate_release_notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:

- name: Get the list of allowed pull request labels
id: get_allowed_labels
env:
PROJECT_ROOT: ${{ github.workspace }}
run: |
RED='\033[0;31m'
FILE_NAME=.release_notes_allowed_labels_list
Expand All @@ -32,8 +34,6 @@ jobs:
ALLOWED_LABELS=$(cat $FILE_PATH)
echo -e "allowed_labels=$ALLOWED_LABELS" >> $GITHUB_OUTPUT
echo -e "Allowed labels are: $ALLOWED_LABELS"
env:
PROJECT_ROOT: ${{ github.workspace }}
generate_release_notes:
runs-on: ubuntu-latest
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Generate release notes
id: generate_release_notes
env:
ALLOWED_LABELS: ${{ needs.get_allowed_labels.outputs.allowed_labels }}
ALLOWED_LABELS: ${{ needs.get_allowed_labels.outputs.allowed-labels }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
run: |
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
# Extract the PR body
PR_BODY=$(echo "$PR_RESPONSE" | jq -r '.body')
for LABEL in "${ALLOWED_LABELS_ARRAY[@]}"; do
HEADER="### $LABEL"
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ jobs:
generate_release_notes:
name: Generate release notes
uses: ./.github/workflows/generate_release_notes.yml
create_release_notes_pr:
name: Create release notes pr
needs: generate_release_notes
uses: ./.github/workflows/create_release_notes_pr.yml
secrets: inherit
with:
version-name: "9.9.9"
release-notes: ${{ needs.generate_release_notes.outputs.release-notes }}

0 comments on commit 5efb7de

Please sign in to comment.