Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pro 4734 check outdated deps #4301

Merged
merged 129 commits into from
Oct 4, 2023
Merged

Pro 4734 check outdated deps #4301

merged 129 commits into from
Oct 4, 2023

Conversation

ETLaurent
Copy link
Contributor

@ETLaurent ETLaurent commented Sep 26, 2023

image

@linear
Copy link

linear bot commented Sep 26, 2023

PRO-4734 Update project actions to look for stale dependencies to make it easier to stay ahead of the monthly maintenance work.

For projects and packages we routinely maintain, we should add a scheduled Github action bi-weekly to run npm outdated which will give us a report of the dependencies that are out of date. Using this output we can gauge the level of effort for updating dependencies. ( Could even be able update minor versions automatically, if we think that is safe )

Make sure it calls attention to major versions being out of date.

Here is an example of a scheduled task from Holon which was used to keep the dev branch in sync with main. The relevant part is the on.schedule:

name: Sync

on:
  schedule:
    # Runs Mon-Fri at 0:00 UTC ( 00:00 EST )
    - cron: "0 0 * * 1-5"

jobs:
  sync-branch:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkoutmaster

      - name: Merge main to dev
        uses: devmasx/merge-branchmaster
        with:
          type: now
          from_branch: main
          target_branch: dev
          github_token: ${{ github.token }}
          message: '[Automated] Merged main into dev'

This ticket is to create the action not to add to every project.

Acceptance Criteria:

Installed and working in the apostrophe repo

This sends a report via Slack webhook in our #product-development Slack channel

@ETLaurent ETLaurent force-pushed the pro-4734-check-outdated-deps branch from 128bdf1 to 17a5b8c Compare September 26, 2023 09:48
- name: Check outdated dependencies
run: |
echo "$(npm outdated)" > output
npm outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

way of getting the correct exit status

Copy link
Member

Choose a reason for hiding this comment

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

npm outdated > output should do this by itself 🤔 Unless your goal was just to always add a newline. Not wrong though

Copy link
Contributor Author

@ETLaurent ETLaurent Sep 28, 2023

Choose a reason for hiding this comment

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

I wasn't able to keep the exit status when writing the output into the output file, so I'm running the same command again... not pretty but it works and makes the step fail as expected.
i.e: echo "$(npm outdated)" > output always exit 0

@ETLaurent ETLaurent marked this pull request as ready for review September 27, 2023 14:46
# - cron: "0 0 * * 1-5"
schedule:
# Runs Mon-Fri at 0:00 UTC ( 00:00 EST )
- cron: "0 0 * * 1-5"
Copy link
Member

Choose a reason for hiding this comment

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

Once every two weeks would be more appropriate. We will never be 100% up to date with the same major version of everything, often up to date modules require older but maintained versions of other modules, etc. If we generate this report daily we will become blind to it (:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would every week do?
I found a syntax to run it every 2 week: 0 8 * * MON test $((10#$(date +\%W)\%2)) -eq 1, but it's not compatible with GA

- name: Check outdated dependencies
run: |
echo "$(npm outdated)" > output
npm outdated
Copy link
Member

Choose a reason for hiding this comment

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

npm outdated > output should do this by itself 🤔 Unless your goal was just to always add a newline. Not wrong though

@ETLaurent ETLaurent requested a review from boutell September 28, 2023 12:32
Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

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

Once a week will have to do. 👍

@ETLaurent ETLaurent merged commit 1e4e437 into main Oct 4, 2023
8 checks passed
@ETLaurent ETLaurent deleted the pro-4734-check-outdated-deps branch October 4, 2023 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants