Skip to content

Commit

Permalink
fix: try and correct copilot yaml errors
Browse files Browse the repository at this point in the history
  • Loading branch information
philclifford committed May 19, 2024
1 parent 267a81a commit 0206ba0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/proc_deprecated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ current_date=$(date +%Y%m%d)
# get the current branch
current_branch=$(git rev-parse --abbrev-ref HEAD)
# get the current user
current_user=$(git config user.email)
# current_user=$(git config user.email)
# get the current user name
current_user_name=$(git config user.name)

Expand All @@ -23,18 +23,22 @@ app_list=$(echo $app_list | sed 's/#//g')
for app in $app_list
do
# get the last time the app was modified
last_modified=$(git log -1 --format="%ai" -- 01-main/manifest | grep $app | awk '{print $1}')
echo "Checking app: $app"
echo "Blame: $(git blame -1 -e --date short -- 01-main/manifest | grep "${app}$" )"
last_modified=$(git blame -1 -e --date short -- 01-main/manifest | grep "${app}$" | awk '{print $3}')
echo "Last modified: $last_modified"
# get the number of months since the app was last modified
months_since_modified=$(echo $(( ( $(date --date="$current_date" +%s) - $(date --date="$last_modified" +%s) )/(60*60*24*30) )))
# if the app was last modified more than 6 months ago
echo "App: $app was last modified $months_since_modified months ago"
if [ $months_since_modified -gt 6 ]
then
# add the app to the list of apps that are deprecated
deprecated_apps="$deprecated_apps $app"
fi
done


echo "Deprecated apps: $deprecated_apps"

if [ -z "$deprecated_apps" ]
then
Expand All @@ -48,7 +52,7 @@ git checkout -b remove_deprecated_apps-${current_date}
for app in $deprecated_apps
do
# remove the app from the manifest
sed -i "/${app} /d" 01-main/manifest
sed -i "/${app}$/d" 01-main/manifest
# remove the app definition
git rm 01-main/packages/${app}
# commit the change
Expand All @@ -57,9 +61,9 @@ done

# create a PR for the branch
#hub pull-request -m "chore: Remove deprecated apps" -b deb-get:main -h deb-get:remove_deprecated_apps-${current_date}
gh pr create --title "chore: Remove deprecated apps" --body "This PR removes the following deprecated apps from the manifest: $deprecated_apps" --base main --head remove_deprecated_apps-${current_date}
gh pr create --title "chore: Remove deprecated apps" --assign philclifford --body "This PR removes the following deprecated apps from the manifest: $deprecated_apps" --base main --head remove_deprecated_apps-${current_date}
# assign the PR to the user who ran the script and deb-get-devs
gh pr edit --assignee $current_user_name,deb-get-devs
# gh pr edit --assignee "$current_user_name",deb-get-devs
# switch back to the original branch
git checkout $current_branch
# cleanup
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/proc_deprecated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,29 @@ name: Process Deprecated Apps
on:
# run on demand
workflow_dispatch:
push:
branches:
- test-ci-deprecation-chore
# schedule:
# - cron: '0 0 * * *'
jobs:
process_deprecated_apps:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install gh
run: |
run: |
curl -sL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt-get update
sudo apt-get install gh
- name: Run script
run: |
run: |
bash .github/workflows/proc_deprecated.sh
# TODO
Expand Down

0 comments on commit 0206ba0

Please sign in to comment.