-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
Various GH workflow improvements #98
Open
Panquesito7
wants to merge
3
commits into
TheAlgorithms:master
Choose a base branch
from
Panquesito7:action_improvements
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Directory writer | ||
on: | ||
schedule: | ||
# ┌───────────── minute (0 - 59) | ||
# │ ┌───────────── hour (0 - 23) | ||
# │ │ ┌───────────── day of the month (1 - 31) | ||
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | ||
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# * * * * * | ||
- cron: '0 0 * * *' | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
if: github.repository == 'TheAlgorithms/R' # We only need this to run in our repository. | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build directory | ||
uses: TheAlgorithms/scripts/directory_md@main | ||
with: | ||
language: R | ||
working-directory: . | ||
filetypes: .r | ||
ignored-directories: .github/,documentation/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,40 @@ | ||
name: Documentation | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
MakeDocs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- name: Setup R | ||
uses: r-lib/actions/setup-r@v2-branch | ||
with: | ||
r-version: '4.1.0' | ||
- name: Create Documentation directory | ||
run: | | ||
echo "Creating 'Documentation'" | ||
echo "Creating documentation directory" | ||
mkdir -p documentation | ||
- name: Install knitr dependency | ||
run: | | ||
echo "Installing R package dependencies. Scripts might have additional dependencies installed." | ||
Rscript -e 'if (!require(knitr)) install.packages("knitr")' | ||
- name: Documentation compilation | ||
run: 'Rscript .github/scripts/doc_builder.r' | ||
- name: Commit Documentation | ||
- name: Setup Git | ||
run: | | ||
echo "Setting up Git" | ||
git config --global user.name github-actions[bot] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe you could get username and email from an environment variable? |
||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: Creating a branch | ||
run: | | ||
git diff-index --quiet HEAD && exit | ||
echo "Setting up Git to push changes." | ||
git config --global user.name 'autoprettier' | ||
git config --global user.email '[email protected]' | ||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | ||
echo "Staging documentation" | ||
git add documentation/ # This is the only directory that has changes and should be staged | ||
git commit -m "Update documentation" || true | ||
git push || true | ||
git checkout -b docs_update-${{ github.sha }} | ||
- name: Commit and push changes | ||
run: | | ||
if [[ `git status --porcelain` ]]; | ||
then | ||
echo "Staging and committing documentation changes" | ||
git add documentation/ | ||
git commit -m "Update documentation" || true | ||
git push origin docs_update-${{ github.sha }}:docs_update-${{ github.sha }} | ||
|
||
gh pr create --base ${GITHUB_REF##*/} --head docs_update-${{ github.sha }} --title '' --body 'Updated the documentation files (see the diff. for changes).' || true | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Filename formatter | ||
on: [push, workflow_dispatch] | ||
jobs: | ||
formatter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Filename Formatter | ||
uses: TheAlgorithms/scripts/formatter@main | ||
with: | ||
filetypes: .r | ||
ignore-files: documentation/,.github/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There is an extra space
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.
What extra space? 🤔
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.
Here