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

Bug: release-please workflow runs release steps after merging a non-release PR #8

Closed
2 tasks
mdjermanovic opened this issue May 7, 2024 · 4 comments · Fixed by #9 or #10
Closed
2 tasks

Bug: release-please workflow runs release steps after merging a non-release PR #8

mdjermanovic opened this issue May 7, 2024 · 4 comments · Fixed by #9 or #10
Assignees
Labels
accepted bug Something isn't working

Comments

@mdjermanovic
Copy link
Member

Which packages are affected?

  • @eslint/object-schema

Environment

This is a CI/CD issue.

What did you do?

Yesterday, I merged #6 and wanted to check the release-please workflow run.

Here's the run that was triggered by that merge:

https://github.com/eslint/rewrite/actions/runs/8967052291

In the release-please workflow, like in other our repos, some steps should be run only when we merge a release PR (i.e. when we want to publish a new version of the package):

# Output which releases were created
- run: echo "A release was created."
if: ${{ steps.release.outputs.releases_created }}
# Check to see if we need to do any releases and if so check out the repo
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.releases_created }}
# Node.js release
- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.releases_created }}
with:
node-version: lts/*
registry-url: "https://registry.npmjs.org"
- run: npm install
if: ${{ steps.release.outputs.releases_created }}
#-----------------------------------------------------------------------------
# @eslint/object-schema
#-----------------------------------------------------------------------------
- name: Publish @eslint/object-schema package to npm
run: npm publish -w packages/object-schema
if: ${{ steps.release.outputs['packages/object-schema--release_created'] }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish @eslint/object-schema package to JSR
run: |
npm run build --if-present
npx jsr publish
working-directory: packages/object-schema
if: ${{ steps.release.outputs['packages/object-schema--release_created'] }}
- name: Tweet Release Announcement
run: npx @humanwhocodes/tweet "@eslint/object-schema v${{ steps.release.outputs['packages/object-schema--major'] }}.${{ steps.release.outputs['packages/object-schema--minor'] }}.${{ steps.release.outputs['packages/object-schema--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/object-schema--tag_name'] }}"
if: ${{ steps.release.outputs['packages/object-schema--release_created'] }}
env:
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
- name: Toot Release Announcement
run: npx @humanwhocodes/toot "@eslint/object-schema v${{ steps.release.outputs['packages/object-schema--major'] }}.${{ steps.release.outputs['packages/object-schema--minor'] }}.${{ steps.release.outputs['packages/object-schema--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/object-schema--tag_name'] }}"'
if: ${{ steps.release.outputs['packages/object-schema--release_created'] }}
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}
#-----------------------------------------------------------------------------
# @eslint/config-array
#-----------------------------------------------------------------------------
- name: Publish @eslint/config-array package to npm
run: npm publish -w packages/config-array
if: ${{ steps.release.outputs['packages/config-array--release_created'] }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish @eslint/config-array package to JSR
run: |
npm run build --if-present
npx jsr publish
working-directory: packages/config-array
if: ${{ steps.release.outputs['packages/config-array--release_created'] }}
- name: Tweet Release Announcement
run: npx @humanwhocodes/tweet "@eslint/config-array v${{ steps.release.outputs['packages/config-array--major'] }}.${{ steps.release.outputs['packages/config-array--minor'] }}.${{ steps.release.outputs['packages/config-array--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/config-array--tag_name'] }}"
if: ${{ steps.release.outputs['packages/config-array--release_created'] }}
env:
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
- name: Toot Release Announcement
run: npx @humanwhocodes/toot "@eslint/config-array v${{ steps.release.outputs['packages/config-array--major'] }}.${{ steps.release.outputs['packages/config-array--minor'] }}.${{ steps.release.outputs['packages/config-array--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/config-array--tag_name'] }}"'
if: ${{ steps.release.outputs['packages/config-array--release_created'] }}
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}

What did you expect to happen?

Since this was a "normal" (non-release) PR, I expected the above steps not to run.

What actually happened?

The run printed "A release was created." and proceeded to checkout the repo, install Node.js, and package dependencies.

It didn't proceed with further steps that would publish the packages, but it could be just because the PR wasn't changing any files in them.

Link to Minimal Reproducible Example

N/A

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@mdjermanovic mdjermanovic added the bug Something isn't working label May 7, 2024
@nzakas
Copy link
Member

nzakas commented May 7, 2024

This doesn't appear to be happening any more:
https://github.com/eslint/rewrite/actions/runs/8987072983/job/24684660538

However, there's another error. I think it's confused about the version numbers and needs a baseline to start from.

@mdjermanovic
Copy link
Member Author

However, there's another error.

The new error seems to be fixed by #9, but the error from the original post still exists in the latest run:

https://github.com/eslint/rewrite/actions/runs/8997389474

@mdjermanovic mdjermanovic reopened this May 8, 2024
@mdjermanovic
Copy link
Member Author

To clarify, my concern is less about running unnecessary installation steps, it's more than it might continue to the publish steps in case that the merged PR was changing files inside the packages.

@mdjermanovic
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working
Projects
Archived in project
2 participants