From 0206ba0d41afed3b509c53fdd8a242ba3b31ced4 Mon Sep 17 00:00:00 2001 From: Phil Clifford Date: Sun, 19 May 2024 10:27:10 +0100 Subject: [PATCH] fix: try and correct copilot yaml errors --- .github/workflows/proc_deprecated.sh | 16 ++++++++++------ .github/workflows/proc_deprecated.yml | 15 +++++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/workflows/proc_deprecated.sh b/.github/workflows/proc_deprecated.sh index 30f9a71a..83999d65 100644 --- a/.github/workflows/proc_deprecated.sh +++ b/.github/workflows/proc_deprecated.sh @@ -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) @@ -23,10 +23,14 @@ 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 @@ -34,7 +38,7 @@ do fi done - +echo "Deprecated apps: $deprecated_apps" if [ -z "$deprecated_apps" ] then @@ -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 @@ -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 diff --git a/.github/workflows/proc_deprecated.yml b/.github/workflows/proc_deprecated.yml index a5265d32..cd443d36 100644 --- a/.github/workflows/proc_deprecated.yml +++ b/.github/workflows/proc_deprecated.yml @@ -3,6 +3,9 @@ name: Process Deprecated Apps on: # run on demand workflow_dispatch: + push: + branches: + - test-ci-deprecation-chore # schedule: # - cron: '0 0 * * *' jobs: @@ -10,19 +13,19 @@ jobs: 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