Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comment on PRs in CI environments #1081

Merged
merged 2 commits into from Feb 18, 2024
Merged

Conversation

EnricoVacondio
Copy link
Contributor

@EnricoVacondio EnricoVacondio commented Feb 18, 2024

closes #1057

As described in the issue #1057 the comments aren't added in CI environment.
Here is a simple fix for it.

I was trying to understand why they weren't enabled but actually I do not see any reason.

@webpro
Copy link
Collaborator

webpro commented Feb 18, 2024

Thanks @EnricoVacondio! Personally I rarely use release-it from CI, so didn't bother to add this yet. Any chance you could add a test or somehow show me this actually works in CI?

@EnricoVacondio
Copy link
Contributor Author

@webpro Sure!
Here is the workflow that I used to test:

name: Release
run-name: 🚀 Release

on:
  push:
    branches:
      - main

permissions:
  contents: write
  pull-requests: write

jobs:
  release-it:
    name: Release it
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Github config
        run: |
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git config user.name "github-actions[bot]"

      - name: Install
        run: |
          yarn install

      - name: Release
        run: |
          yarn release-it --verbose
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

with the following configuration

git:
  commitMessage: "[skip ci] chore: release v${version}"
  tagName: "v${version}"
  addUntrackedFiles: true
npm:
  publish: false
github:
  release: true
  releaseName: "Release v${version}"
  comments:
    submit: true
    issue: ":rocket: _This issue has been resolved in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"
    pr: ":rocket: _This pull request is included in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"
plugins:
  "@release-it/conventional-changelog":
    preset: "angular"
    infile: "CHANGELOG.md"

The output is:
Screenshot 2024-02-18 at 16 11 35

I also tested the default behaviour and of course the comments are not posted on PRs.
Let me know if you need more info.

@webpro webpro merged commit a1961d0 into release-it:main Feb 18, 2024
8 checks passed
@webpro
Copy link
Collaborator

webpro commented Feb 18, 2024

🚀 This pull request is included in v17.1.0. See Release 17.1.0 for release notes.

@webpro
Copy link
Collaborator

webpro commented Feb 18, 2024

Thanks again @EnricoVacondio!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Package is not adding comments on PRs included in the release
2 participants