Skip to content

ci: delete testing fork pre-releases using upstream tag names#48

Merged
zimeg merged 4 commits intomainfrom
zimeg-ci-delete-fork-prereleases-2
Apr 17, 2025
Merged

ci: delete testing fork pre-releases using upstream tag names#48
zimeg merged 4 commits intomainfrom
zimeg-ci-delete-fork-prereleases-2

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented Apr 17, 2025

Summary

This PR uses either an upstream or fork PR branch when deleting a pre-release after a pull request is merged.

Fixes an issue where upstream tag names use different convention from forks and also where this workflow runs.

Requirements

@zimeg zimeg added semver:patch Use on pull requests to describe the release version increment build M-T: Changes to compilation and CI processes labels Apr 17, 2025
@zimeg zimeg added this to the Next Release milestone Apr 17, 2025
@zimeg zimeg self-assigned this Apr 17, 2025
@codecov
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.89%. Comparing base (a1bcf9e) to head (3b01cd6).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #48   +/-   ##
=======================================
  Coverage   62.89%   62.89%           
=======================================
  Files         210      210           
  Lines       22147    22147           
=======================================
  Hits        13930    13930           
  Misses       7129     7129           
  Partials     1088     1088           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zimeg
Copy link
Member Author

zimeg commented Apr 17, 2025

📝 Commit 7593a1b logs the REF from a pull request on the upstream as expected:

REF=zimeg-ci-delete-fork-prereleases-2

https://github.com/slackapi/slack-cli/actions/runs/14526446447/job/40758810974?pr=48

@zimeg
Copy link
Member Author

zimeg commented Apr 17, 2025

📝 Commit e4dce67 logs the REF from a pull request on a fork branch as expected:

REF=pull-44-head

https://github.com/slackapi/slack-cli/actions/runs/14526503952/job/40758962739?pr=44

@zimeg
Copy link
Member Author

zimeg commented Apr 17, 2025

📝 For reference of both above changes, existing prereleases follow similar patterns that'd be matched using semver prefixes:

Copy link
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📣 A note on changes and findings in tests are included in comments both above and below for the kind reviewers.

Comment on lines +7 to +9
pull_request:
types:
- closed
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 An update removed the check that the PR merged since we're wanting to delete these pre-releases after any PR closes I believe

@zimeg zimeg marked this pull request as ready for review April 17, 2025 23:30
@zimeg zimeg requested a review from a team as a code owner April 17, 2025 23:30
Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Nice and great approach to bringing both branch names into alignment!

@zimeg
Copy link
Member Author

zimeg commented Apr 17, 2025

@mwbrooks Thanks so much. 🎁

I'm not so thrilled with the added lines here, but I believe this now lets us test branches from forks using pre-releases and clean things up afterwards. Let's test this in a few PRs soon though!

@zimeg zimeg merged commit e34e518 into main Apr 17, 2025
6 checks passed
@zimeg zimeg deleted the zimeg-ci-delete-fork-prereleases-2 branch April 17, 2025 23:48
@zimeg
Copy link
Member Author

zimeg commented Apr 17, 2025

📣 This PR pre-release was found and deleted!

Identified pre-release tagname to 🔪: v3.0.4-zimeg-ci-delete-fork-prereleases-2
...
Successfully deleted v3.0.4-zimeg-ci-delete-fork-prereleases-2

@zimeg
Copy link
Member Author

zimeg commented Apr 18, 2025

🤔 A deleted PR from a forked branch failed:

Identified pre-release tagname to 🔪: v3.0.4-pull-42-head
...
HTTP 403: Resource not accessible by integration (https://api.github.com/repos/slackapi/slack-cli/releases/212933814)
Failed to find v3.0.4-pull-42-head, trying next...

Which might be due to the pull_request existing in the context of a forked PR. I believe pull_request_target is the ideal choice for a follow up:

This event runs in the context of the base of the pull request, rather than in the context of the merge commit, as the pull_request event does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build M-T: Changes to compilation and CI processes semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants