Skip to content

Conversation

leo-step
Copy link
Contributor

Implementing automatic question metadata updates using GitHub workflows and LeetCode's GraphQL API

@leo-step
Copy link
Contributor Author

leo-step commented Jul 29, 2022

Completed first step as outlined in issue #179

  1. Introduce a GitHub Workflow (without any cron job for now) to automatically run the Python script you had authored in update difficulties for questions #177 and print the output to the console - this should introduce us to GitHub Workflows with hopefully a straight-forward template

Using act for local testing.

@leo-step leo-step marked this pull request as draft July 29, 2022 15:28
Copy link
Owner

@seanprashad seanprashad left a comment

Choose a reason for hiding this comment

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

This is looking like a great start! We can definitely land it now - we might need to refactor how we import our question list since it looks like questions.py is a Python file and not JSON. I don't think this is a huge problem, but something to be aware of when we fully integrate things!

Edit: What were the commands you were using to verify the syntax/logic using act? I'm trying to replicate it on my end, however my console isn't printing anything out running:

 sprashad@home  ~/projects/leetcode-patterns   graphql-cron-job  act -v DEBU[0000] Loading environment from /Users/sprashad/projects/leetcode-patterns/.env DEBU[0000] Loading secrets from /Users/sprashad/projects/leetcode-patterns/.secrets DEBU[0000] Loading workflows from '/Users/sprashad/projects/leetcode-patterns/.github/workflows' DEBU[0000] Loading workflows recursively DEBU[0000] Found workflow 'run-python.yml' in '/Users/sprashad/projects/leetcode-patterns/.github/workflows/run-python.yml' DEBU[0000] Reading workflow '/Users/sprashad/projects/leetcode-patterns/.github/workflows/run-python.yml' DEBU[0000] Planning event: push
@leo-step leo-step marked this pull request as ready for review July 29, 2022 17:15
@leo-step
Copy link
Contributor Author

leo-step commented Jul 29, 2022

This is looking like a great start! We can definitely land it now - we might need to refactor how we import our question list since it looks like questions.py is a Python file and not JSON. I don't think this is a huge problem, but something to be aware of when we fully integrate things!

Edit: What were the commands you were using to verify the syntax/logic using act? I'm trying to replicate it on my end, however my console isn't printing anything out running:

 sprashad@home  ~/projects/leetcode-patterns   graphql-cron-job  act -v DEBU[0000] Loading environment from /Users/sprashad/projects/leetcode-patterns/.env DEBU[0000] Loading secrets from /Users/sprashad/projects/leetcode-patterns/.secrets DEBU[0000] Loading workflows from '/Users/sprashad/projects/leetcode-patterns/.github/workflows' DEBU[0000] Loading workflows recursively DEBU[0000] Found workflow 'run-python.yml' in '/Users/sprashad/projects/leetcode-patterns/.github/workflows/run-python.yml' DEBU[0000] Reading workflow '/Users/sprashad/projects/leetcode-patterns/.github/workflows/run-python.yml' DEBU[0000] Planning event: push

I was running act workflow_dispatch --container-architecture linux/amd64 (you might not need the flag, I was using it because I'm on an M1 Mac).

Also, yes, I should change the questions to be in json format, but I just implemented everything as I had it originally for now.

@seanprashad seanprashad merged commit 6593519 into seanprashad:master Jul 29, 2022
@seanprashad
Copy link
Owner

This is looking like a great start! We can definitely land it now - we might need to refactor how we import our question list since it looks like questions.py is a Python file and not JSON. I don't think this is a huge problem, but something to be aware of when we fully integrate things!
Edit: What were the commands you were using to verify the syntax/logic using act? I'm trying to replicate it on my end, however my console isn't printing anything out running:

 sprashad@home  ~/projects/leetcode-patterns   graphql-cron-job  act -v DEBU[0000] Loading environment from /Users/sprashad/projects/leetcode-patterns/.env DEBU[0000] Loading secrets from /Users/sprashad/projects/leetcode-patterns/.secrets DEBU[0000] Loading workflows from '/Users/sprashad/projects/leetcode-patterns/.github/workflows' DEBU[0000] Loading workflows recursively DEBU[0000] Found workflow 'run-python.yml' in '/Users/sprashad/projects/leetcode-patterns/.github/workflows/run-python.yml' DEBU[0000] Reading workflow '/Users/sprashad/projects/leetcode-patterns/.github/workflows/run-python.yml' DEBU[0000] Planning event: push

I was running act workflow_dispatch --container-architecture linux/amd64 (you might not need the flag, I was using it because I'm on an M1 Mac).

Also, yes, I should change the questions to be in json format, but I just implemented everything as I had it originally for now.

Sounds good! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants