-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into better_channels_tsv_errors
- Loading branch information
Showing
24 changed files
with
1,252 additions
and
735 deletions.
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 |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: update submodules | ||
|
||
# This workflow will checkout the tracked branch of all submodules | ||
# and will update the submodule pull the latest commit of that submodule branch | ||
|
||
# If the branch was not up to date this will then open a PR against the base branch | ||
# in the repo this submodule belongs to. | ||
|
||
# ---- WARNING ---- | ||
# Currently if the submodule is not tracking the default branch, | ||
# this will workflow will fail. | ||
# | ||
|
||
# requires sudmodules URL to be "https..." (no ssh) | ||
|
||
# requires submodule to be specified to follow a specific branch (stored in .gitmodules) | ||
# | ||
# clone them with: | ||
# | ||
# git submodule add -b branch_to_follow https://github.com/... submodule_path | ||
# | ||
# or specify it with: | ||
# | ||
# git config -f .gitmodules submodule.submodule_path.branch branch_to_follow | ||
# | ||
|
||
# Uses the cron schedule for github actions | ||
# | ||
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events | ||
# | ||
# ┌───────────── 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) | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# * * * * * | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
|
||
# to trigger update manually from the Action tab in github | ||
workflow_dispatch: | ||
inputs: | ||
log: | ||
description: "Log" | ||
required: false | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
update_submodules: | ||
# only trigger update on upstream repo | ||
if: github.repository_owner == 'bids-standard' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Clone repo | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
# check out the correct branch for each submodule and pull them all | ||
# https://stackoverflow.com/questions/5828324/update-git-submodule-to-latest-commit-on-origin | ||
- name: Update submodules | ||
run: | | ||
set -e -u | ||
start_dir=$PWD | ||
submodules=$(git submodule | awk '{print $2}') | ||
nb_submod=$(echo "${submodules}" | wc -l) | ||
echo -e "\nUPDATING ${nb_submod} SUBMODULES" | ||
echo -e "${submodules}" | ||
paths=$(git config --file .gitmodules --name-only --get-regexp path) | ||
branches=$(git config --file .gitmodules --name-only --get-regexp branch) | ||
for i in $(seq 1 "${nb_submod}"); do | ||
path=$(echo "${paths}" | awk -v i="${i}" '{print $i}') | ||
path=$(git config --get --file .gitmodules "${path}") | ||
branch=$(echo "${branches}" | awk -v i="${i}" '{print $i}') | ||
branch=$(git config --get --file .gitmodules "${branch}") | ||
echo -e "\nswitching submodule ${path} to ${branch}" | ||
cd "${path}" || exit | ||
git checkout "${branch}" | ||
cd "${start_dir}" | ||
done | ||
git submodule update --remote --merge | ||
# if there have been changes, | ||
# a PR is created using the checkout branch for this workflow | ||
# https://github.com/peter-evans/create-pull-request | ||
- name: Create Pull-Request | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
commit-message: Update submodules | ||
delete-branch: true | ||
title: "[BOT] Updating git submodules" | ||
body: "Update git submodules via [CI](https://github.com/bids-standard/bids-validator/blob/master/.github/workflows/update_submodules.yml)." |
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,3 +1,4 @@ | ||
[submodule "bids-examples"] | ||
path = bids-validator/tests/data/bids-examples | ||
url = https://github.com/bids-standard/bids-examples.git | ||
branch = master |
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
Oops, something went wrong.