Skip to content

Action db update#1025

Merged
avinashkranjan merged 5 commits into
avinashkranjan:masterfrom
XZANATOL:action_db_update
May 10, 2021
Merged

Action db update#1025
avinashkranjan merged 5 commits into
avinashkranjan:masterfrom
XZANATOL:action_db_update

Conversation

@XZANATOL

@XZANATOL XZANATOL commented May 8, 2021

Copy link
Copy Markdown
Contributor

Description

Added GitHub action files to automatically update JSON database in ./Master Script directory.

Fixes number #831

Didn't correctly link the issue to not auto close it

Have you read the Contributing Guidelines on Pull Requests?

  • Yes
  • No

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Documentation Update

Checklist:

  • My code follows the style guidelines(Clean Code) of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have created a helpful and easy to understand README.md
  • My documentation follows Template for README.md
  • My changes generate no new warnings
  • I have added tests/screenshots(if any) that prove my fix is effective or that my feature works.

@kaustubhgupta kaustubhgupta added the Urgent Issues needed to be address Immediately label May 8, 2021
@XZANATOL

XZANATOL commented May 8, 2021

Copy link
Copy Markdown
Contributor Author

Why am I feeling nervous? 😂

@kaustubhgupta kaustubhgupta self-requested a review May 8, 2021 12:37
@kaustubhgupta

Copy link
Copy Markdown
Contributor

Why am I feeling nervous? 😂

nope nope, it's for me to filter out important issue first 😁😁

@kaustubhgupta kaustubhgupta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A couple of changes:

Comment thread .github/pull_request_template.md Outdated
@@ -36,3 +36,38 @@ _Please delete options that are not relevant._
- [ ] My documentation follows [`Template for README.md`](https://github.com/avinashkranjan/Amazing-Python-Scripts/blob/master/Template%20for%20README.md)
- [ ] My changes generate no new warnings
- [ ] I have added tests/screenshots(if any) that prove my fix is effective or that my feature works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a new check point for this:

  • I have added the project meta data in the PR template.

Comment thread .github/pull_request_template.md Outdated
Comment on lines 37 to 38
- [ ] My changes generate no new warnings
- [ ] I have added tests/screenshots(if any) that prove my fix is effective or that my feature works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove these two points

Comment thread .github/pull_request_template.md
Comment thread .github/pull_request_template.md Outdated
Comment thread .github/pull_request_template.md Outdated
Comment thread Master Script/Script.py
@@ -14,6 +14,9 @@
parser = OptionParser()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename this file to manual db updater

Comment thread .github/scripts/Update_Database.py
Comment thread .github/workflows/database_auto_updater.yml
@XZANATOL XZANATOL requested a review from kaustubhgupta May 8, 2021 13:17
@kaustubhgupta

kaustubhgupta commented May 8, 2021

Copy link
Copy Markdown
Contributor

@XZANATOL I can't see your new commits. Only the previous 2 commits are visible

@XZANATOL

XZANATOL commented May 8, 2021

Copy link
Copy Markdown
Contributor Author

I didn't make any commits yet, check the comments on the changes you requested.

@kaustubhgupta

Copy link
Copy Markdown
Contributor

I didn't make any commits yet, check the comments on the changes you requested.

there are no comments from your side on those changes

@XZANATOL XZANATOL left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh I didn't realize that I should submit the conversations xd my bad

Comment thread .github/pull_request_template.md Outdated
Comment thread .github/pull_request_template.md Outdated
Comment thread .github/pull_request_template.md Outdated
Comment thread .github/scripts/Update_Database.py
Comment thread .github/workflows/database_auto_updater.yml
Comment thread .github/pull_request_template.md
Comment thread .github/pull_request_template.md
Comment thread .github/pull_request_template.md Outdated
Comment thread .github/pull_request_template.md Outdated
Comment thread .github/pull_request_template.md Outdated
Comment thread .github/pull_request_template.md Outdated
Comment thread .github/pull_request_template.md Outdated
Comment thread .github/pull_request_template.md Outdated
Comment thread .github/scripts/Update_Database.py Outdated
@XZANATOL XZANATOL requested a review from kaustubhgupta May 9, 2021 18:27
@XZANATOL

XZANATOL commented May 9, 2021

Copy link
Copy Markdown
Contributor Author

Ah right.. after merging the action we can directly test it from my other openned PR #1002 , I've edited it's PR body and after merging you can directly test it out (if I wasn't online at that time.)

Comment thread .github/pull_request_template.md Outdated

`` If there is no-file/nothing to fill the below fields with, then type: none ``

`` Example: `` If no requirements.txt needed/present then type in ``Requirments`` none => ``Requirments: none``

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Umm, I have a question here, According to the regex rule you have in line 10:
requirments_path = r"Requirments: (.+)"

I think it will capture this value irrespective of the case where I am providing a path to file in line 62 in this PR template. This will make every entry in the database none for requirements. I think you can restructure this line as:

Suggested change
`` Example: `` If no requirements.txt needed/present then type in ``Requirments`` none => ``Requirments: none``
`` Example: `` If no requirements.txt needed/present, then type none in ``Requirments``.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually there is no need to worry here. I'm using re.match() method not re.search() to get the contents. re.match() will match the whole string not search inside of it.. it's like ==

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, I realized this after running through multiple test

Comment thread .github/scripts/Update_Database.py Outdated
print("[+] PyGithub Login Success!")
repo = git.get_repo("avinashkranjan/Amazing-Python-Scripts")
datastore_file = repo.get_contents("./Master Script/datastore.json")
repo.update_file(datastore_file.path, "Updated datastore.json", data_store, datastore_file.sha, branch="main")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A major error:

Suggested change
repo.update_file(datastore_file.path, "Updated datastore.json", data_store, datastore_file.sha, branch="main")
repo.update_file(datastore_file.path, "Updated datastore.json", data_store, datastore_file.sha, branch="master")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh.. my bad on that one.. I always get confused between them. xd

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues, I have fixed this

@kaustubhgupta

Copy link
Copy Markdown
Contributor

Also, check out this log:

https://github.com/kaustubhgupta/gitpractise/runs/2545434245?check_suite_focus=true

The file is not being pushed to the gh-pages branch as the sha values are not matching for both branches. I think you need to get the contents of the master branch and gh-pages branch separately and then use the .update_file method to push the files

@kaustubhgupta kaustubhgupta added the bug Something isn't working label May 10, 2021
Did all the necessay changes
@kaustubhgupta

Copy link
Copy Markdown
Contributor

@XZANATOL Never mind, I have handled these errors and committed the same.

@kaustubhgupta kaustubhgupta added next review needed Approved by some mentors, more approvals needed and removed bug Something isn't working labels May 10, 2021
@XZANATOL

Copy link
Copy Markdown
Contributor Author

Hi, have just got home.. xd
Lemme take a look at the requested

@kaustubhgupta

Copy link
Copy Markdown
Contributor

@XZANATOL Finally the script worked successfully on this repo: https://github.com/kaustubhgupta/gitpractise

After 12 PRs xd

@XZANATOL

Copy link
Copy Markdown
Contributor Author

I think this is the hardest challenge I've ever faced. tho it was fun! xD

@avinashkranjan avinashkranjan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM..Great Work Guys @XZANATOL & @kaustubhgupta

@avinashkranjan avinashkranjan merged commit fe77510 into avinashkranjan:master May 10, 2021
@XZANATOL

XZANATOL commented May 10, 2021

Copy link
Copy Markdown
Contributor Author

@kaustubhgupta just before forgetting, can you add GSSOC labels? xd + test the action in #1002

@kaustubhgupta kaustubhgupta added Approved PR Approved and Ready to Merge gssoc23 Issues created for/by the GirlScript Summer of Code'23 Participants level3 New features, Major bug fixing and removed next review needed Approved by some mentors, more approvals needed labels May 11, 2021
@kaustubhgupta

Copy link
Copy Markdown
Contributor

@kaustubhgupta just before forgetting, can you add GSSOC labels? xd + test the action in #1002

Done ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved PR Approved and Ready to Merge gssoc23 Issues created for/by the GirlScript Summer of Code'23 Participants level3 New features, Major bug fixing Urgent Issues needed to be address Immediately

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants