From b25a41bd0b04f949089f14ff3b098fb786aa973d Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 14:50:41 -0700 Subject: [PATCH 01/26] [hackathon24] add a release-note action --- .github/workflows/release-notes.yml | 73 +++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/release-notes.yml diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml new file mode 100644 index 0000000..1e8a90d --- /dev/null +++ b/.github/workflows/release-notes.yml @@ -0,0 +1,73 @@ +name: Create Release Notes PR +on: + release: + types: [published] + +jobs: + add-release-notes: + runs-on: ubuntu-latest + + steps: + - name: Generate release notes + run: | + RELEASE_NAME="${{ github.event.release.name }}" + RELEASE_BODY="${{ github.event.release.body }}" + RELEASE_TAG="${{ github.event.release.tag_name }}" + RELEASE_DATE=$(date +%Y-%m-%d) + REPO_NAME="Plugin Pipeline Example" + CATEGORIES="wordpress,plugin" + RELEASE_LINK="https://github.com/${{ github.repository }}/releases/tag/${RELEASE_TAG}" + + cat < release-note.md + --- + title: ${REPO_NAME} ${RELEASE_TAG} now available + published_date: "${RELEASE_DATE}" + categories: [${CATEGORIES}] + --- + + The latest version of ${REPO_NAME}, [${RELEASE_TAG}](${RELEASE_LINK}), is available as of $(date +"%B, %d, %Y"). + + ${RELEASE_BODY} + EOF + + echo "release_notes_path=$(pwd)/release-note.md" >> $GITHUB_ENV + echo "release_date=${RELEASE_DATE}" >> $GITHUB_ENV + echo "repo_name=${REPO_NAME}" >> $GITHUB_ENV + echo "release_note_categories=${CATEGORIES}" >> $GITHUB_ENV + echo "release_link=${RELEASE_LINK}" >> $GITHUB_ENV + - name: Copy Release Notes & Create PR + env: + GITHUB_TOKEN: ${{ secrets.TOKEN }} + run: | + REPO_SLUG=$(basename "${{ github.repository }}") + PR_TITLE="Release notes for ${{ env.repo_name }} ${{ github.event.release.tag_name }}" + RELEASE_NOTE_FILENAME="${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}.md" + 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 }})." + PR_BRANCH="releasenote-${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}" + + + echo "Cloning the docs repo" + git clone https://github.com/pantheon-systems/documentation.git + echo "Copying the release notes" + mv "${{ env.release_notes_path }}" documentation/source/releasenotes/${RELEASE_NOTE_FILENAME} + cat ${RELEASE_NOTE_FILENAME} + + cd documentation + + echo "Setting up git config" + git config --global user.name "Pantheon Bot" + git config --global user.email "bot@getpantheon.com" + git checkout -b releasenote-${RELEASE_NOTE_FILENAME} + git add source/releasenotes/${RELEASE_NOTE_FILENAME} + git commit -m "Add release notes for ${REPO_NAME} ${{ github.event.release.tag_name }}" + git push --set-upstream origin releasenote-${RELEASE_NOTE_FILENAME} + + echo "Create pull request" + gh pr create \ + --repo pantheon-systems/documentation \ + --base main \ + --head ${PR_BRANCH} \ + --title "${PR_TITLE}" \ + --body "${PR_BODY}" + + \ No newline at end of file From 6dca8f3b0e9b118c2e9920668e8bfad6ec03051c Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 14:52:23 -0700 Subject: [PATCH 02/26] use my docs repo fork --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 1e8a90d..e9feef0 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -47,7 +47,7 @@ jobs: echo "Cloning the docs repo" - git clone https://github.com/pantheon-systems/documentation.git + git clone https://github.com/jazzsequence/documentation.git echo "Copying the release notes" mv "${{ env.release_notes_path }}" documentation/source/releasenotes/${RELEASE_NOTE_FILENAME} cat ${RELEASE_NOTE_FILENAME} From ee3589e1a8eca18ce35f171e81fe5689ccea6174 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 14:59:33 -0700 Subject: [PATCH 03/26] add debugging --- .github/workflows/release-notes.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index e9feef0..0bb02ab 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -35,6 +35,10 @@ jobs: echo "repo_name=${REPO_NAME}" >> $GITHUB_ENV echo "release_note_categories=${CATEGORIES}" >> $GITHUB_ENV echo "release_link=${RELEASE_LINK}" >> $GITHUB_ENV + - name: Debug generated file + run: | + ls -l $(pwd) + cat release-note.md - name: Copy Release Notes & Create PR env: GITHUB_TOKEN: ${{ secrets.TOKEN }} @@ -49,7 +53,16 @@ jobs: echo "Cloning the docs repo" git clone https://github.com/jazzsequence/documentation.git echo "Copying the release notes" - mv "${{ env.release_notes_path }}" documentation/source/releasenotes/${RELEASE_NOTE_FILENAME} + echo "Current directory: $(pwd)" + ls -l + ls -l documentation/source/releasenotes/ + if [ -f "${{ env.release_notes_path }}" ]; then + mv "${{ env.release_notes_path }}" documentation/source/releasenotes/${RELEASE_NOTE_FILENAME} + echo "Release notes copied successfully." + else + echo "Error: Release notes file not found at ${{ env.release_notes_path }}" + exit 1 + fi cat ${RELEASE_NOTE_FILENAME} cd documentation From 36b12626f265ed629a8bfd1d1b2287bb7f63a196 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:06:27 -0700 Subject: [PATCH 04/26] [hackathon24] replace . with - --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 0bb02ab..27f55ad 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -45,7 +45,7 @@ jobs: run: | REPO_SLUG=$(basename "${{ github.repository }}") PR_TITLE="Release notes for ${{ env.repo_name }} ${{ github.event.release.tag_name }}" - RELEASE_NOTE_FILENAME="${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}.md" + RELEASE_NOTE_FILENAME="${{ env.release_date }}-${REPO_SLUG}-$(echo "${{ github.event.release.tag_name }}" | tr '.' '-').md" 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 }})." PR_BRANCH="releasenote-${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}" From 3ff71595a3da0792dc35bc3a4143694c6567159d Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:07:46 -0700 Subject: [PATCH 05/26] [hackathon24] cat the full path --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 27f55ad..f707296 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -63,7 +63,7 @@ jobs: echo "Error: Release notes file not found at ${{ env.release_notes_path }}" exit 1 fi - cat ${RELEASE_NOTE_FILENAME} + cat documentation/source/releasenotes/"${RELEASE_NOTE_FILENAME}" cd documentation From cd53dda5bfb95d27329b715c1aa12e23e708bdd3 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:10:48 -0700 Subject: [PATCH 06/26] [hackathon24] remove debugging --- .github/workflows/release-notes.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index f707296..0b56449 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -35,10 +35,6 @@ jobs: echo "repo_name=${REPO_NAME}" >> $GITHUB_ENV echo "release_note_categories=${CATEGORIES}" >> $GITHUB_ENV echo "release_link=${RELEASE_LINK}" >> $GITHUB_ENV - - name: Debug generated file - run: | - ls -l $(pwd) - cat release-note.md - name: Copy Release Notes & Create PR env: GITHUB_TOKEN: ${{ secrets.TOKEN }} @@ -53,9 +49,6 @@ jobs: echo "Cloning the docs repo" git clone https://github.com/jazzsequence/documentation.git echo "Copying the release notes" - echo "Current directory: $(pwd)" - ls -l - ls -l documentation/source/releasenotes/ if [ -f "${{ env.release_notes_path }}" ]; then mv "${{ env.release_notes_path }}" documentation/source/releasenotes/${RELEASE_NOTE_FILENAME} echo "Release notes copied successfully." From c7752ff765186a4ef0b7cb5e13c6de31218d92f1 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:21:31 -0700 Subject: [PATCH 07/26] [hackathon24] set up remote with PAT --- .github/workflows/release-notes.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 0b56449..2553048 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -44,10 +44,8 @@ jobs: RELEASE_NOTE_FILENAME="${{ env.release_date }}-${REPO_SLUG}-$(echo "${{ github.event.release.tag_name }}" | tr '.' '-').md" 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 }})." PR_BRANCH="releasenote-${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}" - - - echo "Cloning the docs repo" - git clone https://github.com/jazzsequence/documentation.git + echo "Cloning the docs repo" + git clone https://github.com/jazzsequence/documentation.git echo "Copying the release notes" if [ -f "${{ env.release_notes_path }}" ]; then mv "${{ env.release_notes_path }}" documentation/source/releasenotes/${RELEASE_NOTE_FILENAME} @@ -63,6 +61,7 @@ jobs: echo "Setting up git config" git config --global user.name "Pantheon Bot" git config --global user.email "bot@getpantheon.com" + git remote set-url origin https://${{ secrets.TOKEN }}@github.com/jazzsequence/documentation.git git checkout -b releasenote-${RELEASE_NOTE_FILENAME} git add source/releasenotes/${RELEASE_NOTE_FILENAME} git commit -m "Add release notes for ${REPO_NAME} ${{ github.event.release.tag_name }}" From fd6c39829649f718138e5fab084dc8b02508c084 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:27:06 -0700 Subject: [PATCH 08/26] [hackathon24] create the PR against the right repo --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 2553048..c2bca1b 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -69,7 +69,7 @@ jobs: echo "Create pull request" gh pr create \ - --repo pantheon-systems/documentation \ + --repo jazzsequence/documentation \ --base main \ --head ${PR_BRANCH} \ --title "${PR_TITLE}" \ From a06ab3d9f982a7b104c9889bec1897dacfeb7562 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:42:37 -0700 Subject: [PATCH 09/26] [hackathon24] specify destination repository --- .github/workflows/release-notes.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index c2bca1b..78a3295 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -70,8 +70,8 @@ jobs: echo "Create pull request" gh pr create \ --repo jazzsequence/documentation \ - --base main \ - --head ${PR_BRANCH} \ + --base jazzsequence:main \ + --head jazzsequence:${PR_BRANCH} \ --title "${PR_TITLE}" \ --body "${PR_BODY}" From 1b6c80c5ecffbb03207287e337c403bb1fd33666 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:44:45 -0700 Subject: [PATCH 10/26] [hackathon24] use the base branch that we're actually creating test releases from --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 78a3295..ff890a9 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -70,7 +70,7 @@ jobs: echo "Create pull request" gh pr create \ --repo jazzsequence/documentation \ - --base jazzsequence:main \ + --base hackathon24-release-notes-action \ --head jazzsequence:${PR_BRANCH} \ --title "${PR_TITLE}" \ --body "${PR_BODY}" From fc43c212de7a48415759d1444b8d714904169822 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:45:06 -0700 Subject: [PATCH 11/26] [hackathon24] remove repository owner not needed, probably --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index ff890a9..8eb5d55 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -71,7 +71,7 @@ jobs: gh pr create \ --repo jazzsequence/documentation \ --base hackathon24-release-notes-action \ - --head jazzsequence:${PR_BRANCH} \ + --head ${PR_BRANCH} \ --title "${PR_TITLE}" \ --body "${PR_BODY}" From 0f1eb46070ac4b6e84ab0b40477ea9c935ba3c0b Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:48:13 -0700 Subject: [PATCH 12/26] [hackathon24] get base branch from release --- .github/workflows/release-notes.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 8eb5d55..d5ab592 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -44,6 +44,8 @@ jobs: RELEASE_NOTE_FILENAME="${{ env.release_date }}-${REPO_SLUG}-$(echo "${{ github.event.release.tag_name }}" | tr '.' '-').md" 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 }})." PR_BRANCH="releasenote-${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}" + BASE_BRANCH="${{ github.event.release.target_commitish }}" + echo "Cloning the docs repo" git clone https://github.com/jazzsequence/documentation.git echo "Copying the release notes" @@ -67,11 +69,15 @@ jobs: git commit -m "Add release notes for ${REPO_NAME} ${{ github.event.release.tag_name }}" git push --set-upstream origin releasenote-${RELEASE_NOTE_FILENAME} + echo "Debugging branch differences" + git log ${BASE_BRANCH}..${PR_BRANCH} --oneline + git diff --name-only ${BASE_BRANCH}..${PR_BRANCH} + echo "Create pull request" gh pr create \ --repo jazzsequence/documentation \ - --base hackathon24-release-notes-action \ - --head ${PR_BRANCH} \ + --base ${BASE_BRANCH} \ + --head jazzsequence:${PR_BRANCH} \ --title "${PR_TITLE}" \ --body "${PR_BODY}" From 7b94bd678df721682bcecc09e449bbb6ddb8c0fa Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:53:48 -0700 Subject: [PATCH 13/26] [hackathon24] put things back --- .github/workflows/release-notes.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index d5ab592..7b003f7 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -44,7 +44,6 @@ jobs: RELEASE_NOTE_FILENAME="${{ env.release_date }}-${REPO_SLUG}-$(echo "${{ github.event.release.tag_name }}" | tr '.' '-').md" 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 }})." PR_BRANCH="releasenote-${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}" - BASE_BRANCH="${{ github.event.release.target_commitish }}" echo "Cloning the docs repo" git clone https://github.com/jazzsequence/documentation.git @@ -76,8 +75,8 @@ jobs: echo "Create pull request" gh pr create \ --repo jazzsequence/documentation \ - --base ${BASE_BRANCH} \ - --head jazzsequence:${PR_BRANCH} \ + --base main \ + --head ${PR_BRANCH} \ --title "${PR_TITLE}" \ --body "${PR_BODY}" From 76cec5897c9bbfe0661923473d003742b4806d35 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 15:54:58 -0700 Subject: [PATCH 14/26] [hackathon24] remove debugging --- .github/workflows/release-notes.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 7b003f7..c6aaaa8 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -68,10 +68,6 @@ jobs: git commit -m "Add release notes for ${REPO_NAME} ${{ github.event.release.tag_name }}" git push --set-upstream origin releasenote-${RELEASE_NOTE_FILENAME} - echo "Debugging branch differences" - git log ${BASE_BRANCH}..${PR_BRANCH} --oneline - git diff --name-only ${BASE_BRANCH}..${PR_BRANCH} - echo "Create pull request" gh pr create \ --repo jazzsequence/documentation \ From a03100aebd553e961cc2c5a9ac10aefccac0e504 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 16:03:43 -0700 Subject: [PATCH 15/26] [hackathon24] check if the branch exists on the remote --- .github/workflows/release-notes.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index c6aaaa8..1104228 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -68,6 +68,18 @@ jobs: git commit -m "Add release notes for ${REPO_NAME} ${{ github.event.release.tag_name }}" git push --set-upstream origin releasenote-${RELEASE_NOTE_FILENAME} + RETRIES=0 + while ! git ls-remote --heads origin ${PR_BRANCH} | grep -q "${PR_BRANCH}"; do + RETRIES=$((RETRIES+1)) + if [ ${RETRIES} -ge 5 ]; then + echo "Branch ${PR_BRANCH} still not found after 5 retries. Exiting..." + exit 1 + fi + echo "Branch ${PR_BRANCH} not found on remote. Waiting for propagation...(${RETRIES}/5)" + sleep 5 + done + echo "Branch ${PR_BRANCH} exists on remote." + echo "Create pull request" gh pr create \ --repo jazzsequence/documentation \ From 43eea513a92cec808e7a0340453186625ff6acfd Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 16:05:59 -0700 Subject: [PATCH 16/26] [hackathon24] checkout and push the right branch --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 1104228..03b6bc5 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -63,7 +63,7 @@ jobs: git config --global user.name "Pantheon Bot" git config --global user.email "bot@getpantheon.com" git remote set-url origin https://${{ secrets.TOKEN }}@github.com/jazzsequence/documentation.git - git checkout -b releasenote-${RELEASE_NOTE_FILENAME} + git checkout -b ${PR_BRANCH} git add source/releasenotes/${RELEASE_NOTE_FILENAME} git commit -m "Add release notes for ${REPO_NAME} ${{ github.event.release.tag_name }}" git push --set-upstream origin releasenote-${RELEASE_NOTE_FILENAME} From 677f10b903a413200f3c5964d7060e7a3605e4be Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 20 Nov 2024 16:07:31 -0700 Subject: [PATCH 17/26] [hackathon24] fix the branch to push --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 03b6bc5..3eaad82 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -66,7 +66,7 @@ jobs: git checkout -b ${PR_BRANCH} git add source/releasenotes/${RELEASE_NOTE_FILENAME} git commit -m "Add release notes for ${REPO_NAME} ${{ github.event.release.tag_name }}" - git push --set-upstream origin releasenote-${RELEASE_NOTE_FILENAME} + git push --set-upstream origin ${PR_BRANCH} RETRIES=0 while ! git ls-remote --heads origin ${PR_BRANCH} | grep -q "${PR_BRANCH}"; do From 27a3a83a4ec4d9ba9db705c0e61675d64fd28936 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 21 Nov 2024 08:17:55 -0700 Subject: [PATCH 18/26] [hackathon24] remove bullet --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 3eaad82..4f13a3e 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -42,7 +42,7 @@ jobs: REPO_SLUG=$(basename "${{ github.repository }}") PR_TITLE="Release notes for ${{ env.repo_name }} ${{ github.event.release.tag_name }}" RELEASE_NOTE_FILENAME="${{ env.release_date }}-${REPO_SLUG}-$(echo "${{ github.event.release.tag_name }}" | tr '.' '-').md" - 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 }})." + 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 }})." PR_BRANCH="releasenote-${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}" echo "Cloning the docs repo" From dde903d5137f239514e7229996d1d1f1986104dc Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 21 Nov 2024 09:15:22 -0700 Subject: [PATCH 19/26] [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 --- .github/workflows/release-notes.yml | 86 ++--------------------------- 1 file changed, 6 insertions(+), 80 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 4f13a3e..d4b1266 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -9,83 +9,9 @@ jobs: steps: - name: Generate release notes - run: | - RELEASE_NAME="${{ github.event.release.name }}" - RELEASE_BODY="${{ github.event.release.body }}" - RELEASE_TAG="${{ github.event.release.tag_name }}" - RELEASE_DATE=$(date +%Y-%m-%d) - REPO_NAME="Plugin Pipeline Example" - CATEGORIES="wordpress,plugin" - RELEASE_LINK="https://github.com/${{ github.repository }}/releases/tag/${RELEASE_TAG}" - - cat < release-note.md - --- - title: ${REPO_NAME} ${RELEASE_TAG} now available - published_date: "${RELEASE_DATE}" - categories: [${CATEGORIES}] - --- - - The latest version of ${REPO_NAME}, [${RELEASE_TAG}](${RELEASE_LINK}), is available as of $(date +"%B, %d, %Y"). - - ${RELEASE_BODY} - EOF - - echo "release_notes_path=$(pwd)/release-note.md" >> $GITHUB_ENV - echo "release_date=${RELEASE_DATE}" >> $GITHUB_ENV - echo "repo_name=${REPO_NAME}" >> $GITHUB_ENV - echo "release_note_categories=${CATEGORIES}" >> $GITHUB_ENV - echo "release_link=${RELEASE_LINK}" >> $GITHUB_ENV - - name: Copy Release Notes & Create PR - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} - run: | - REPO_SLUG=$(basename "${{ github.repository }}") - PR_TITLE="Release notes for ${{ env.repo_name }} ${{ github.event.release.tag_name }}" - RELEASE_NOTE_FILENAME="${{ env.release_date }}-${REPO_SLUG}-$(echo "${{ github.event.release.tag_name }}" | tr '.' '-').md" - 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 }})." - PR_BRANCH="releasenote-${{ env.release_date }}-${REPO_SLUG}-${{ github.event.release.tag_name }}" - - echo "Cloning the docs repo" - git clone https://github.com/jazzsequence/documentation.git - echo "Copying the release notes" - if [ -f "${{ env.release_notes_path }}" ]; then - mv "${{ env.release_notes_path }}" documentation/source/releasenotes/${RELEASE_NOTE_FILENAME} - echo "Release notes copied successfully." - else - echo "Error: Release notes file not found at ${{ env.release_notes_path }}" - exit 1 - fi - cat documentation/source/releasenotes/"${RELEASE_NOTE_FILENAME}" - - cd documentation - - echo "Setting up git config" - git config --global user.name "Pantheon Bot" - git config --global user.email "bot@getpantheon.com" - git remote set-url origin https://${{ secrets.TOKEN }}@github.com/jazzsequence/documentation.git - git checkout -b ${PR_BRANCH} - git add source/releasenotes/${RELEASE_NOTE_FILENAME} - git commit -m "Add release notes for ${REPO_NAME} ${{ github.event.release.tag_name }}" - git push --set-upstream origin ${PR_BRANCH} - - RETRIES=0 - while ! git ls-remote --heads origin ${PR_BRANCH} | grep -q "${PR_BRANCH}"; do - RETRIES=$((RETRIES+1)) - if [ ${RETRIES} -ge 5 ]; then - echo "Branch ${PR_BRANCH} still not found after 5 retries. Exiting..." - exit 1 - fi - echo "Branch ${PR_BRANCH} not found on remote. Waiting for propagation...(${RETRIES}/5)" - sleep 5 - done - echo "Branch ${PR_BRANCH} exists on remote." - - echo "Create pull request" - gh pr create \ - --repo jazzsequence/documentation \ - --base main \ - --head ${PR_BRANCH} \ - --title "${PR_TITLE}" \ - --body "${PR_BODY}" - - \ No newline at end of file + uses: pantheon-systems/action-release-notes@main + with: + github_token: ${{ secrets.token }} + docs_repo: jazzsequence/documentation + repo_name: Plugin Pipeline Example + categories: wordpress,plugins \ No newline at end of file From 4a7f6c5fc0b366b87e229780e71ea06e9e42d7ba Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 21 Nov 2024 09:31:09 -0700 Subject: [PATCH 20/26] [hackathon24] add permissions --- .github/workflows/release-notes.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index d4b1266..b7d434d 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -6,6 +6,8 @@ on: jobs: add-release-notes: runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Generate release notes From def161938a3f7d76a46196999101ed05a040cac8 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 21 Nov 2024 09:34:42 -0700 Subject: [PATCH 21/26] [hackathon24] add a checkout action to debug this will checkout the action repository, in theory --- .github/workflows/release-notes.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index b7d434d..c3b13b6 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -10,6 +10,10 @@ jobs: contents: read steps: + - name: (Debugging) Checkout Action Repository + uses: actions/checkout@v4 + with: + repository: pantheon-systems/action-release-notes - name: Generate release notes uses: pantheon-systems/action-release-notes@main with: From 4f4c7bc2e512ccf07d49891878751e52a8eeaa3d Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 21 Nov 2024 09:40:23 -0700 Subject: [PATCH 22/26] [hackathon24] update the token this is primarily for the pantheon-systems version --- .github/workflows/release-notes.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index c3b13b6..6d83c06 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -10,14 +10,11 @@ jobs: contents: read steps: - - name: (Debugging) Checkout Action Repository - uses: actions/checkout@v4 - with: - repository: pantheon-systems/action-release-notes - name: Generate release notes uses: pantheon-systems/action-release-notes@main with: - github_token: ${{ secrets.token }} + token: ${{ secrets.TOKEN }} + github_token: ${{ secrets.TOKEN }} docs_repo: jazzsequence/documentation repo_name: Plugin Pipeline Example categories: wordpress,plugins \ No newline at end of file From a7ac2601d7642700e9918fb371f3440bf38ed4ab Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 21 Nov 2024 09:57:35 -0700 Subject: [PATCH 23/26] [hackathon24] remove duplicative token & add to env this might mean the github_token input is unnecessary if it's in the env --- .github/workflows/release-notes.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 6d83c06..16ff440 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -12,8 +12,9 @@ jobs: steps: - name: Generate release notes uses: pantheon-systems/action-release-notes@main + env: + GH_TOKEN: ${{ secrets.TOKEN }} with: - token: ${{ secrets.TOKEN }} github_token: ${{ secrets.TOKEN }} docs_repo: jazzsequence/documentation repo_name: Plugin Pipeline Example From 0c364e0b9c7e524cd95b20dfe560e8cf4d1c8a54 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 21 Nov 2024 14:42:22 -0700 Subject: [PATCH 24/26] [hackathon24] remove unnecessary inputs --- .github/workflows/release-notes.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 16ff440..7b539c7 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -15,7 +15,5 @@ jobs: env: GH_TOKEN: ${{ secrets.TOKEN }} with: - github_token: ${{ secrets.TOKEN }} - docs_repo: jazzsequence/documentation repo_name: Plugin Pipeline Example categories: wordpress,plugins \ No newline at end of file From b3b3d6c6bc083f639f3e7e8cb55ec231700183fc Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 21 Nov 2024 14:47:13 -0700 Subject: [PATCH 25/26] [hackathon24] use the develop branch --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 7b539c7..3565bfb 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Generate release notes - uses: pantheon-systems/action-release-notes@main + uses: pantheon-systems/action-release-notes@develop env: GH_TOKEN: ${{ secrets.TOKEN }} with: From c5d96ade75bfab21283928be6363597e19cccab7 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 21 Nov 2024 14:49:08 -0700 Subject: [PATCH 26/26] [hackathon24] re-ad github_token todo, re-add as required --- .github/workflows/release-notes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 3565bfb..c19c565 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -15,5 +15,6 @@ jobs: env: GH_TOKEN: ${{ secrets.TOKEN }} with: + github_token: ${{ secrets.TOKEN }} repo_name: Plugin Pipeline Example categories: wordpress,plugins \ No newline at end of file