Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST_TEMPLATE/archive.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ Cheers and thank you for contributing to conda-forge!

* [x] I want to archive a feedstock:
* [ ] Pinged the team for that feedstock for their input.
* [ ] Make sure you have opened an issue on the feedstock explaining why it was archived.
* [ ] Linked that issue in this PR description.
* [ ] Specified the reason for archiving the feedstock in the request.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added this step to make it clear that the workflow has changed. I'm wondering if we perhaps shouldn't an "or" here, also noting that people can link an existing issue instead.

* [ ] Added links to any other relevant issues/PRs in the PR description.

<!--
Expand Down
16 changes: 14 additions & 2 deletions conda_forge_admin_requests/archive_feedstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .utils import GH_ORG, get_gh_headers, raise_json_for_status


def process_repo(repo, task):
def process_repo(repo, task, reason=None):
owner = GH_ORG
headers = get_gh_headers()

Expand All @@ -29,6 +29,18 @@ def process_repo(repo, task):
print(f"feedstock {repo} is already {target_status}", flush=True)
return

if task == "archive" and reason is not None:
r = requests.post(
f"https://api.github.com/repos/{owner}/{repo}/issues",
headers=headers,
json={
"title": "Archive the feedstock",
"body": reason,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bug #1324 mentioned cross-linking to the PR. If we wanted to do this, I think our best guess is parsing the merge commit (if any) for PR reference, though I think it's a bit gross, so let me know if you want that.

},
)
raise_json_for_status(r)
print(f"archival issue created: {r.json()['html_url']}", flush=True)

r = requests.patch(
f"https://api.github.com/repos/{owner}/{repo}",
headers=headers,
Expand All @@ -46,7 +58,7 @@ def run(request):
pkgs_to_do_again = []
for feedstock in feedstocks:
try:
process_repo(f"{feedstock}-feedstock", task)
process_repo(f"{feedstock}-feedstock", task, reason=request.get("reason"))
except Exception as e:
print(f"failed to {task} '{feedstock}': {e!r}", flush=True)
pkgs_to_do_again.append(feedstock)
Expand Down
4 changes: 4 additions & 0 deletions examples/example-archive.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
action: archive
# The reason will be used to create the archival issue on the feedstock.
# If one is already present, remove the "reason:" key to disable creating a new issue.
reason: >
The project has been archived upstream.
feedstocks:
- cf-autotick-bot-test-package
Loading