Chore: Batch update changelog.md in main branch (#106051)
This commit is contained in:
@@ -22,6 +22,10 @@ on:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
work_branch:
|
||||
required: false
|
||||
type: string
|
||||
description: "Use specific branch for changelog"
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
@@ -45,6 +49,10 @@ on:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
work_branch:
|
||||
required: false
|
||||
type: string
|
||||
description: "Use specific branch for changelog"
|
||||
|
||||
permissions: {}
|
||||
|
||||
@@ -98,7 +106,20 @@ jobs:
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local --add --bool push.autoSetupRemote true
|
||||
- name: "Create branch"
|
||||
run: git checkout -b "changelog/${RUN_ID}/${VERSION}"
|
||||
run: |
|
||||
if [[ "$WORK_BRANCH" == '' ]]; then
|
||||
git switch -c "changelog/${RUN_ID}/${VERSION}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Checkout the changelog branch if exists, otherwise create a new one
|
||||
if git show-ref --verify --quiet "refs/remotes/origin/$WORK_BRANCH"; then
|
||||
git switch --track "origin/$WORK_BRANCH"
|
||||
else
|
||||
git switch -c "$WORK_BRANCH"
|
||||
fi
|
||||
env:
|
||||
WORK_BRANCH: ${{ inputs.work_branch }}
|
||||
- name: "Generate changelog"
|
||||
id: changelog
|
||||
uses: ./.github/actions/changelog
|
||||
@@ -145,13 +166,26 @@ jobs:
|
||||
if: inputs.dry_run != true
|
||||
run: git push
|
||||
- name: "Create changelog PR"
|
||||
run: >
|
||||
gh pr create \
|
||||
--dry-run="${DRY_RUN}" \
|
||||
--label "no-backport" \
|
||||
--label "no-changelog" \
|
||||
-B "${TARGET}" \
|
||||
--title "Release: update changelog for ${VERSION}" \
|
||||
--body "Changelog changes for release ${VERSION}"
|
||||
run: |
|
||||
if gh pr view &>/dev/null; then
|
||||
echo "Changelog pr has already been created"
|
||||
else
|
||||
|
||||
gh pr create \
|
||||
--dry-run="${DRY_RUN}" \
|
||||
--label "no-backport" \
|
||||
--label "no-changelog" \
|
||||
-B "${TARGET}" \
|
||||
--title "Release: update changelog for ${TARGET}" \
|
||||
--body "Changelog changes for release versions:"
|
||||
fi
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: "Add release version to PR description"
|
||||
if: inputs.dry_run != true
|
||||
run: |
|
||||
gh pr view --json body --jq .body > pr_body.md
|
||||
echo " - ${VERSION}" >> pr_body.md
|
||||
gh pr edit --body-file pr_body.md
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -32,25 +32,59 @@ on:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
release_date:
|
||||
required: false
|
||||
type: string
|
||||
description: "Release date in format YYYY-MM-DD"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
capture-date:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_date: ${{ steps.set_release_date.outputs.release_date }}
|
||||
steps:
|
||||
- name: compute_release_date
|
||||
run: |
|
||||
if [ -n "$DATE" ]; then
|
||||
echo "release_date=$DATE" >> "$GITHUB_ENV"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Fetching workflow run creation date..."
|
||||
created_at=$(gh run view "$GITHUB_RUN_ID" --repo "$GH_REPO" --json createdAt -q .createdAt)
|
||||
formatted_date=$(date -d "$created_at" +%Y-%m-%d)
|
||||
echo "release_date=$formatted_date" >> "$GITHUB_ENV"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
DATE: ${{ inputs.release_date }}
|
||||
|
||||
- id: set_release_date
|
||||
run: echo "release_date=$release_date" >> "$GITHUB_OUTPUT"
|
||||
|
||||
push-changelog-to-main:
|
||||
needs: capture-date
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
pull-requests: write
|
||||
|
||||
name: Create PR to main to update the changelog
|
||||
uses: ./.github/workflows/changelog.yml
|
||||
concurrency:
|
||||
group: grafana-release-pr-update-changelog-main
|
||||
cancel-in-progress: false
|
||||
with:
|
||||
previous_version: ${{inputs.previous_version}}
|
||||
version: ${{ inputs.version }}
|
||||
latest: ${{ inputs.latest }}
|
||||
dry_run: ${{ inputs.dry_run }}
|
||||
target: main
|
||||
work_branch: changelog/update-changelog-${{ needs.capture-date.outputs.release_date }}
|
||||
|
||||
create-prs:
|
||||
permissions:
|
||||
|
||||
Reference in New Issue
Block a user