Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
ucb-bar
/
chipyard
Public
Notifications
You must be signed in to change notification settings
Fork
913
Star
2.4k
Code
Issues
157
Pull requests
45
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Files
Expand file tree
0acc1e1de2d3284bcd4d876956932a013ffe1949
Breadcrumbs
chipyard
/
.github
/
actions
/
cleanup-conda
/
action.yml
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
34 lines (33 loc) · 1.4 KB
0acc1e1
Breadcrumbs
chipyard
/
.github
/
actions
/
cleanup-conda
/
action.yml
Copy path
Top
File metadata and controls
Code
Blame
34 lines (33 loc) · 1.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: cleanup-conda
description: 'Remove extra conda environments'
runs:
using: "composite"
steps:
- name: Remove extra conda environments
run: |
conda env list
CONDA_REMOVE_NAMES=$(conda env list | awk '{print $1}' | tail -n +3 | grep "${{ env.conda-env-name-no-time }}" || true)
if [ -z "$CONDA_REMOVE_NAMES" ]; then
echo "No matching conda environments for ${{ env.conda-env-name-no-time }}. Skip removal."
else
echo "Removing $CONDA_REMOVE_NAMES conda environments."
for env in $CONDA_REMOVE_NAMES; do
conda env remove -n $env
done
fi
IS_NUMBER_REGEX='^[0-9]+$'
conda env list | awk '{print $1}' | tail -n +4 | while read envname; do
ENV_DATE=$(echo $envname | sed "s/cy-[[:digit:]]\+-\(.*\)-\(riscv\|esp\)-tools/\1/")
if ! [[ $ENV_DATE =~ $IS_NUMBER_REGEX ]]; then
echo "Skipping removal of $envname since it cannot be parsed into a date"
else
NUM_DIFF=$(( ( $(date +%s) - $(date --date="$ENV_DATE" +%s) )/(60*60*24) ))
if (( $NUM_DIFF > 2 )); then
echo "Removing $envname since it is $NUM_DIFF days old."
conda env remove -n $envname
else
echo "Skipping removal of $envname since it is $NUM_DIFF days old."
fi
fi
done
shell: bash -leo pipefail {0}
You can’t perform that action at this time.