Skip to content

Commit dde903d

Browse files
committed
[hackathon24] use the action
this will need to be pushed to the actual plugin-pipeline-example repo since the action is internal to pantheon-systems
1 parent 27a3a83 commit dde903d

File tree

1 file changed

+6
-80
lines changed

1 file changed

+6
-80
lines changed

.github/workflows/release-notes.yml

Lines changed: 6 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -9,83 +9,9 @@ jobs:
99

1010
steps:
1111
- name: Generate release notes
12-
run: |
13-
RELEASE_NAME="${{ github.event.release.name }}"
14-
RELEASE_BODY="${{ github.event.release.body }}"
15-
RELEASE_TAG="${{ github.event.release.tag_name }}"
16-
RELEASE_DATE=$(date +%Y-%m-%d)
17-
REPO_NAME="Plugin Pipeline Example"
18-
CATEGORIES="wordpress,plugin"
19-
RELEASE_LINK="https://github.com/${{ github.repository }}/releases/tag/${RELEASE_TAG}"
20-
21-
cat <<EOF > release-note.md
22-
---
23-
title: ${REPO_NAME} ${RELEASE_TAG} now available
24-
published_date: "${RELEASE_DATE}"
25-
categories: [${CATEGORIES}]
26-
---
27-
28-
The latest version of ${REPO_NAME}, [${RELEASE_TAG}](${RELEASE_LINK}), is available as of $(date +"%B, %d, %Y").
29-
30-
${RELEASE_BODY}
31-
EOF
32-
33-
echo "release_notes_path=$(pwd)/release-note.md" >> $GITHUB_ENV
34-
echo "release_date=${RELEASE_DATE}" >> $GITHUB_ENV
35-
echo "repo_name=${REPO_NAME}" >> $GITHUB_ENV
36-
echo "release_note_categories=${CATEGORIES}" >> $GITHUB_ENV
37-
echo "release_link=${RELEASE_LINK}" >> $GITHUB_ENV
38-
- name: Copy Release Notes & Create PR
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.TOKEN }}
41-
run: |
42-
REPO_SLUG=$(basename "${{ github.repository }}")
43-
PR_TITLE="Release notes for ${{ env.repo_name }} ${{ github.event.release.tag_name }}"
44-
RELEASE_NOTE_FILENAME="${{ env.release_date }}-${REPO_SLUG}-$(echo "${{ github.event.release.tag_name }}" | tr '.' '-').md"
45-
PR_BODY="**[Release Notes](https://docs.pantheon.io/releasenotes)** - Adds a release note for ${{ env.repo_name }} [${{ github.event.release.tag_name }}](https://github.com/${{ github.repository }}/releases/tag/${{ github.event.release.tag_name }})."
46-
PR_BRANCH="releasenote-${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}"
47-
48-
echo "Cloning the docs repo"
49-
git clone https://github.com/jazzsequence/documentation.git
50-
echo "Copying the release notes"
51-
if [ -f "${{ env.release_notes_path }}" ]; then
52-
mv "${{ env.release_notes_path }}" documentation/source/releasenotes/${RELEASE_NOTE_FILENAME}
53-
echo "Release notes copied successfully."
54-
else
55-
echo "Error: Release notes file not found at ${{ env.release_notes_path }}"
56-
exit 1
57-
fi
58-
cat documentation/source/releasenotes/"${RELEASE_NOTE_FILENAME}"
59-
60-
cd documentation
61-
62-
echo "Setting up git config"
63-
git config --global user.name "Pantheon Bot"
64-
git config --global user.email "[email protected]"
65-
git remote set-url origin https://${{ secrets.TOKEN }}@github.com/jazzsequence/documentation.git
66-
git checkout -b ${PR_BRANCH}
67-
git add source/releasenotes/${RELEASE_NOTE_FILENAME}
68-
git commit -m "Add release notes for ${REPO_NAME} ${{ github.event.release.tag_name }}"
69-
git push --set-upstream origin ${PR_BRANCH}
70-
71-
RETRIES=0
72-
while ! git ls-remote --heads origin ${PR_BRANCH} | grep -q "${PR_BRANCH}"; do
73-
RETRIES=$((RETRIES+1))
74-
if [ ${RETRIES} -ge 5 ]; then
75-
echo "Branch ${PR_BRANCH} still not found after 5 retries. Exiting..."
76-
exit 1
77-
fi
78-
echo "Branch ${PR_BRANCH} not found on remote. Waiting for propagation...(${RETRIES}/5)"
79-
sleep 5
80-
done
81-
echo "Branch ${PR_BRANCH} exists on remote."
82-
83-
echo "Create pull request"
84-
gh pr create \
85-
--repo jazzsequence/documentation \
86-
--base main \
87-
--head ${PR_BRANCH} \
88-
--title "${PR_TITLE}" \
89-
--body "${PR_BODY}"
90-
91-
12+
uses: pantheon-systems/action-release-notes@main
13+
with:
14+
github_token: ${{ secrets.token }}
15+
docs_repo: jazzsequence/documentation
16+
repo_name: Plugin Pipeline Example
17+
categories: wordpress,plugins

0 commit comments

Comments
 (0)