-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Add autoDIR Action #1546
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
Add autoDIR Action #1546
Conversation
updates_8-17
update 9-12
10-2 rebase
update for travis fix
travis pull ID test
retry pr build
github auth?
add index update for permission fix
run sh for script
add pull directory
Travis test
Added for Issue #1460 |
You need to rebase. It is much easier to review if each PR touches only one file. |
I can do that. Should I cancel this PR and resubmit after rebase? |
If the PR touches more than one file then yes. |
@@ -0,0 +1,29 @@ | |||
name: autoDIR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment and change the name:
# The objective of this GitHub Action is to add a new DIRECTORY.md file to a pull request if needed.
name: directory_writer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make this change for the upcoming PR
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Update DIRECTORY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: Update DIRECTORY.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will make this change in upcoming PR
- name: Update DIRECTORY | ||
run: | | ||
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md | ||
git config --global user.name 'autoDIR' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
directory_writer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will make this change in upcoming PR
git config --global user.email '[email protected]' | ||
git remote set-url origin https://x-access-token:${{ secrets.gh_token }}@github.com/$GITHUB_REPOSITORY | ||
git checkout $GITHUB_HEAD_REF | ||
git diff-files --quiet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that if this command fails then the entire PR is marked with a failing test ❌ which we do not want.
On line 28, use fixup:
instead of Update:
because when a merge happens git will autosquish that commit into the previous commit.
Put a \n
at the end of the file so that GitHub does not put 🚫 at the end of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct @cclauss, the git diff-files --quiet
commands exit code is the same as for git diff-index (0 == no differences; 1 == differences). In this case, if failure, it will continue with the push. Would you have any suggestion for evaluating if the DIRECTORY.md file has changed?
I will make the changes to line 28, and add the newline at the end in upcoming PR
$ python3 >>> import hashlib
>>> def get_file_hexdigest(filepath: str="DIRECTORY.md") -> str:
... with open(filepath, "rb") as in_file:
... return hashlib.md5(in_file.read()).hexdigest()
...
>>> get_file_hexdigest()
'b1c7c4f112361d85016fa4d50cd681e9' Do that once before you generate the DIRECTORY.md and then again after you generate the DIRECTORY.md file. |
This Github action updates the DIRECTORY.md file and pushes back to GH, if it is necessary. FIles updated are from black.py and build_directory_md.py. Not sure if I need to adjust the GH auth.