-
Notifications
You must be signed in to change notification settings - Fork 4
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
ci to update all literature monthly #134
Merged
Merged
Changes from 2 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 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ name: Update data | |
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
pull_request: | ||
|
@@ -11,6 +12,8 @@ on: | |
- "scripts/**" | ||
- "workflow/**" | ||
- ".github/workflows/**" | ||
schedule: | ||
- cron: "45 2 1 * *" # Run monthly at 2:45 am | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
@@ -41,18 +44,38 @@ jobs: | |
conda info | ||
|
||
- name: Check loci and update bed files (short) | ||
#if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'}} | ||
if: ${{ github.event_name == 'pull_request'}} | ||
run: snakemake --config stages="skip-refs" | ||
|
||
# Enable this step to open an SSH session for debugging | ||
# - name: SSH debug | ||
# uses: mxschmitt/action-tmate@v3 | ||
|
||
- name: Find new literature (intermediate) | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
run: | | ||
conda init | ||
source /home/runner/.bashrc | ||
conda activate strchive | ||
snakemake --config stages="new-refs" | ||
|
||
- name: Update all literature (long) | ||
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'}} | ||
run: | | ||
conda init | ||
source /home/runner/.bashrc | ||
conda activate strchive | ||
snakemake | ||
|
||
- name: Open pull request with updated files | ||
if: ${{ !(github.event_name == 'pull_request') }} | ||
if: ${{ !(github.event_name == 'pull_request') || github.event_name == 'schedule' }} | ||
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. This "or schedule" is also unnecessary as it will already be covered by "not pull request" |
||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
branch: update-data | ||
title: Update data | ||
|
||
- name: Commit updated files to current pull request | ||
if: ${{ github.event_name == 'pull_request' }} | ||
if: ${{ github.event_name == 'pull_request' || github.event_name == 'schedule' }} | ||
vincerubinetti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: Update data | ||
commit_message: Update data |
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
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
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
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.
So the long and intermediate steps will both run on workflow dispatches? Just checking that this is what you intended.
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.
The reason I made this comment originally is because, the way they're named "short intermediate long", I would expect them to be mutually exclusive, i.e. only one of them runs each workflow run. But I haven't looked inside the scripts to see what's actually going on yet, is that actually the case? It doesn't have to be; I'd just recommend removing the lengths from the names if not.
Looks like now there's a clear split/association between the three trigger types (pr, schedule, manual) and the three script lengths (short, intermediate, long). Note that schedule and manual will also trigger PR on subsequent commits. Here's a breakdown of the scenarios (in terms of automatic workflow runs):
main
→ nothing happenspull_request
triggers, "short" script runs → updated data committed to PRworkflow_dispatch
→ "intermediate" script runs → PR opened with first commit of updated data → someone commits again to opened PR →pull_request
triggers → "short" script runs → updated data committed to PRschedule
runs once a month → "long" script runs → PR opened with first commit of updated data → someone commits again to opened PR →pull_request
triggers → "short" script runs → updated data committed to PRIf that looks okay, then the PR LGTM
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.
Thanks for breaking that down!
Yes, I think that is the desired behavior. Let's see if that all works out in practice.