diff --git a/.github/workflows/create_release_notes_pr.yml b/.github/workflows/create_release_notes_pr.yml new file mode 100644 index 0000000..d02e6a9 --- /dev/null +++ b/.github/workflows/create_release_notes_pr.yml @@ -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 <> $GITHUB_OUTPUT echo -e "Allowed labels are: $ALLOWED_LABELS" - env: - PROJECT_ROOT: ${{ github.workspace }} generate_release_notes: runs-on: ubuntu-latest @@ -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: | @@ -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" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 03bd8ce..9698262 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }}