Skip to content

Commit

Permalink
dev -> main for 3.1.0 (#3336)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
mashehu and mirpedrol authored Dec 12, 2024
1 parent c2e171a commit 8232947
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
description: "Pipeline to sync"
type: string
default: "all"
debug:
description: "Enable debug/verbose mode (true or false)"
type: boolean
default: false

# Cancel if a newer run is started
concurrency:
Expand Down Expand Up @@ -62,6 +66,8 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
name: Check out nf-core/tools
with:
ref: ${{ github.ref_name }}

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

- name: Set Git default branch from nextflow.config and set git default branch to that or "master"

run: |
pushd nf-core/${{ matrix.pipeline }}
defaultBranch=$(grep -B5 -A5 "nextflowVersion" nextflow.config | grep "defaultBranch" | cut -d"=" -f2)
if [ -z "$defaultBranch" ]; then
defaultBranch="master"
fi
popd
echo "Default branch: $defaultBranch"
echo "defaultBranch=$defaultBranch" >> GITHUB_OUTPUT
git config --global init.defaultBranch $defaultBranch
- name: Run synchronisation
if: github.repository == 'nf-core/tools'
env:
GITHUB_AUTH_TOKEN: ${{ secrets.nf_core_bot_auth_token }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "nf-core-bot"
nf-core --log-file sync_log_${{ matrix.pipeline }}.txt pipelines sync -d nf-core/${{ matrix.pipeline }} \
nf-core --log-file sync_log_${{ matrix.pipeline }}.txt \
${{ github.event.inputs.debug == 'true' && '--verbose' || '' }} \
pipelines sync -d nf-core/${{ matrix.pipeline }} \
--from-branch dev \
--pull-request \
--username nf-core-bot \
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Add `manifest.contributors` to `nextflow.config` ([#3311](https://github.com/nf-core/tools/pull/3311))
- Update template components ([#3328](https://github.com/nf-core/tools/pull/3328))
- Template: Remove mention of GRCh37 if igenomes is skipped ([#3330](https://github.com/nf-core/tools/pull/3330))
- Be more verbose in approval check action ([#3338](https://github.com/nf-core/tools/pull/3338))

### Download

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

### Version updates

Expand Down
15 changes: 13 additions & 2 deletions nf_core/pipeline-template/.github/workflows/awsfulltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,30 @@ jobs:
if: github.repository == '{{ name }}' && github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'master' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: octokit/[email protected]
- name: Get PR reviews
uses: octokit/[email protected]
if: github.event_name != 'workflow_dispatch'
id: check_approvals
continue-on-error: true
with:
route: GET /repos/{%- raw -%}${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews?per_page=100
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: test_variables

- name: Check for approvals
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
run: |
echo "No review approvals found. At least 2 approvals are required to run this action automatically."
exit 1
- name: Check for enough approvals (>=2)
id: test_variables
if: github.event_name != 'workflow_dispatch'
run: |
JSON_RESPONSE='${{ steps.check_approvals.outputs.data }}'{% endraw %}
CURRENT_APPROVALS_COUNT=$(echo $JSON_RESPONSE | jq -c '[.[] | select(.state | contains("APPROVED")) ] | length')
test $CURRENT_APPROVALS_COUNT -ge 2 || exit 1 # At least 2 approvals are required
- name: Launch workflow via Seqera Platform
uses: seqeralabs/action-tower-launch@v2
# TODO nf-core: You can customise AWS full pipeline tests as required
Expand Down
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ validation {
https://doi.org/10.1038/s41587-020-0439-x
* Software dependencies
https://github.com/{{ name }}/blob/master/CITATIONS.md
https://github.com/{{ name }}/blob/{{ default_branch }}/CITATIONS.md
"""{% endif %}
}{% if is_nfcore %}
summary {
Expand Down
8 changes: 4 additions & 4 deletions nf_core/pipelines/create/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(
template_config: Optional[Union[CreateConfig, str, Path]] = None,
organisation: str = "nf-core",
from_config_file: bool = False,
default_branch: str = "main",
default_branch: str = "master",
is_interactive: bool = False,
) -> None:
if isinstance(template_config, CreateConfig):
Expand Down Expand Up @@ -298,7 +298,6 @@ def render_template(self) -> None:
template_dir = Path(nf_core.__file__).parent / "pipeline-template"
object_attrs = self.jinja_params
object_attrs["nf_core_version"] = nf_core.__version__

# Can't use glob.glob() as need recursive hidden dotfiles - https://stackoverflow.com/a/58126417/713980
template_files = list(Path(template_dir).glob("**/*"))
template_files += list(Path(template_dir).glob("*"))
Expand Down Expand Up @@ -431,8 +430,9 @@ def get_default_branch(self) -> None:
"""Gets the default branch name from the Git configuration."""
try:
self.default_branch = (
str(git.config.GitConfigParser().get_value("init", "defaultBranch")) or "main"
) # default to main
str(git.config.GitConfigParser().get_value("init", "defaultBranch")) or "master"
) # default to master
log.debug(f"Default branch name: {self.default_branch}")
except configparser.Error:
log.debug("Could not read init.defaultBranch")
if self.default_branch in ["dev", "TEMPLATE"]:
Expand Down

0 comments on commit 8232947

Please sign in to comment.