Skip to content

Commit

Permalink
ci: write changelog after publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakutoc committed Dec 11, 2024
1 parent f58a58f commit 919816c
Showing 1 changed file with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion .github/workflows/publish-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,60 @@ jobs:
uses: ./.github/workflows/publish-common.yml
with:
with-update-package-lock: true
auto-options: '--no-changelog'
secrets:
gh_token: ${{ secrets.GH_TOKEN }}
npm_registry_token: ${{ secrets.NPM_REGISTRY_TOKEN }}


changelog:
runs-on: ubuntu-latest
needs: [publish]
if: ${{ always() && contains(needs.publish.result, 'success') }}
env:
GITHUB_TOKEN: ${{ secrets.gh_token }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
fetch-depth: 0

- name: Get associated pull request by commit
id: data
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const res = await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
});
const data = res?.data[0].body || '';
return data;
- name: Install dependencies
run: |
cd .github/actions/write-changelog
npm ci
- name: Write changelog
uses: ./.github/actions/write-changelog
with:
data: ${{ steps.data.outputs.result }}

- name: Extract branch name
id: branch
shell: bash
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT

- name: Commit & Push changelog files
uses: actions-js/push@master
with:
github_token: ${{ secrets.gh_token }}
message: 'chore: Update CHANGELOG.md [skip ci]'
branch: ${{ steps.branch.outputs.BRANCH }}
author_name: Salute Frontend Team
author_email: [email protected]

0 comments on commit 919816c

Please sign in to comment.