Skip to content

Commit 8232947

Browse files
mashehumirpedrol
andauthored
dev -> main for 3.1.0 (#3336)
* set default_branch to master for now * update changelog * set git defaultBranch to master in sync action * update changelog * use nextflow.config to set defaultBranch * fix path for nextflow.config grep * change working dir when setting defaultBranch * fix Changelog * Be more verbose in approval check action * fix if clause * update changelog * add verbose mode to sync action * update changelog * Apply suggestions from code review * add input debug for workflow_dispatch sync action * go back to original directory after configuring git defaultBranch * add more debugging on sync GHA * echo message to sync GHA * try exiting pipeline directory before saving defaultBranch * cleanup debugging echo * use same ref in checkout as triggered the workflow * don't set up loggin level to error * Revert "don't set up loggin level to error [no changelog]" * Update nf_core/pipeline-template/.github/workflows/awsfulltest.yml --------- Co-authored-by: Júlia Mir Pedrol <[email protected]>
1 parent c2e171a commit 8232947

File tree

5 files changed

+44
-8
lines changed

5 files changed

+44
-8
lines changed

.github/workflows/sync.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ on:
2323
description: "Pipeline to sync"
2424
type: string
2525
default: "all"
26+
debug:
27+
description: "Enable debug/verbose mode (true or false)"
28+
type: boolean
29+
default: false
2630

2731
# Cancel if a newer run is started
2832
concurrency:
@@ -62,6 +66,8 @@ jobs:
6266
steps:
6367
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
6468
name: Check out nf-core/tools
69+
with:
70+
ref: ${{ github.ref_name }}
6571

6672
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
6773
name: Check out nf-core/${{ matrix.pipeline }}
@@ -87,14 +93,29 @@ jobs:
8793
with:
8894
version: "latest-everything"
8995

96+
- name: Set Git default branch from nextflow.config and set git default branch to that or "master"
97+
98+
run: |
99+
pushd nf-core/${{ matrix.pipeline }}
100+
defaultBranch=$(grep -B5 -A5 "nextflowVersion" nextflow.config | grep "defaultBranch" | cut -d"=" -f2)
101+
if [ -z "$defaultBranch" ]; then
102+
defaultBranch="master"
103+
fi
104+
popd
105+
echo "Default branch: $defaultBranch"
106+
echo "defaultBranch=$defaultBranch" >> GITHUB_OUTPUT
107+
git config --global init.defaultBranch $defaultBranch
108+
90109
- name: Run synchronisation
91110
if: github.repository == 'nf-core/tools'
92111
env:
93112
GITHUB_AUTH_TOKEN: ${{ secrets.nf_core_bot_auth_token }}
94113
run: |
95114
git config --global user.email "[email protected]"
96115
git config --global user.name "nf-core-bot"
97-
nf-core --log-file sync_log_${{ matrix.pipeline }}.txt pipelines sync -d nf-core/${{ matrix.pipeline }} \
116+
nf-core --log-file sync_log_${{ matrix.pipeline }}.txt \
117+
${{ github.event.inputs.debug == 'true' && '--verbose' || '' }} \
118+
pipelines sync -d nf-core/${{ matrix.pipeline }} \
98119
--from-branch dev \
99120
--pull-request \
100121
--username nf-core-bot \

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- Add `manifest.contributors` to `nextflow.config` ([#3311](https://github.com/nf-core/tools/pull/3311))
2424
- Update template components ([#3328](https://github.com/nf-core/tools/pull/3328))
2525
- Template: Remove mention of GRCh37 if igenomes is skipped ([#3330](https://github.com/nf-core/tools/pull/3330))
26+
- Be more verbose in approval check action ([#3338](https://github.com/nf-core/tools/pull/3338))
2627

2728
### Download
2829

@@ -65,6 +66,9 @@
6566
- Don't break gitpod.yml with template string ([#3332](https://github.com/nf-core/tools/pull/3332))
6667
- rocrate: remove duplicated entries for name and version ([#3333](https://github.com/nf-core/tools/pull/3333))
6768
- rocrate: Update crate with version bump and handle new contributor field ([#3334](https://github.com/nf-core/tools/pull/3334))
69+
- set default_branch to master for now ([#3335](https://github.com/nf-core/tools/issues/3335))
70+
- Set git defaultBranch to master in sync action ([#3337](https://github.com/nf-core/tools/pull/3337))
71+
- Add verbose mode to sync action ([#3339](https://github.com/nf-core/tools/pull/3339))
6872

6973
### Version updates
7074

nf_core/pipeline-template/.github/workflows/awsfulltest.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,30 @@ jobs:
1919
if: github.repository == '{{ name }}' && github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'master' || github.event_name == 'workflow_dispatch'
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: octokit/[email protected]
22+
- name: Get PR reviews
23+
uses: octokit/[email protected]
2324
if: github.event_name != 'workflow_dispatch'
2425
id: check_approvals
26+
continue-on-error: true
2527
with:
2628
route: GET /repos/{%- raw -%}${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews?per_page=100
2729
env:
2830
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29-
- id: test_variables
31+
32+
- name: Check for approvals
33+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
34+
run: |
35+
echo "No review approvals found. At least 2 approvals are required to run this action automatically."
36+
exit 1
37+
38+
- name: Check for enough approvals (>=2)
39+
id: test_variables
3040
if: github.event_name != 'workflow_dispatch'
3141
run: |
3242
JSON_RESPONSE='${{ steps.check_approvals.outputs.data }}'{% endraw %}
3343
CURRENT_APPROVALS_COUNT=$(echo $JSON_RESPONSE | jq -c '[.[] | select(.state | contains("APPROVED")) ] | length')
3444
test $CURRENT_APPROVALS_COUNT -ge 2 || exit 1 # At least 2 approvals are required
45+
3546
- name: Launch workflow via Seqera Platform
3647
uses: seqeralabs/action-tower-launch@v2
3748
# TODO nf-core: You can customise AWS full pipeline tests as required

nf_core/pipeline-template/nextflow.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ validation {
327327
https://doi.org/10.1038/s41587-020-0439-x
328328
329329
* Software dependencies
330-
https://github.com/{{ name }}/blob/master/CITATIONS.md
330+
https://github.com/{{ name }}/blob/{{ default_branch }}/CITATIONS.md
331331
"""{% endif %}
332332
}{% if is_nfcore %}
333333
summary {

nf_core/pipelines/create/create.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(
5757
template_config: Optional[Union[CreateConfig, str, Path]] = None,
5858
organisation: str = "nf-core",
5959
from_config_file: bool = False,
60-
default_branch: str = "main",
60+
default_branch: str = "master",
6161
is_interactive: bool = False,
6262
) -> None:
6363
if isinstance(template_config, CreateConfig):
@@ -298,7 +298,6 @@ def render_template(self) -> None:
298298
template_dir = Path(nf_core.__file__).parent / "pipeline-template"
299299
object_attrs = self.jinja_params
300300
object_attrs["nf_core_version"] = nf_core.__version__
301-
302301
# Can't use glob.glob() as need recursive hidden dotfiles - https://stackoverflow.com/a/58126417/713980
303302
template_files = list(Path(template_dir).glob("**/*"))
304303
template_files += list(Path(template_dir).glob("*"))
@@ -431,8 +430,9 @@ def get_default_branch(self) -> None:
431430
"""Gets the default branch name from the Git configuration."""
432431
try:
433432
self.default_branch = (
434-
str(git.config.GitConfigParser().get_value("init", "defaultBranch")) or "main"
435-
) # default to main
433+
str(git.config.GitConfigParser().get_value("init", "defaultBranch")) or "master"
434+
) # default to master
435+
log.debug(f"Default branch name: {self.default_branch}")
436436
except configparser.Error:
437437
log.debug("Could not read init.defaultBranch")
438438
if self.default_branch in ["dev", "TEMPLATE"]:

0 commit comments

Comments
 (0)