Skip to content

Commit

Permalink
listFiles for bioc branch action
Browse files Browse the repository at this point in the history
The prior approach to listing the files did not return an array to FILES (line 6). The new approach immediately lists all files in relevant directories for the bioconductor branch. Files are checked out one at a time in a for loop. Adds bin/bash to the start of the script.
  • Loading branch information
jmitchell81 committed May 9, 2024
1 parent 9ef93f0 commit ffff4c6
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions .github/copy_to_branch.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Designate desired directories and files
SRC_FOLDER_PATHS=(data-raw man R tests vignettes)
SRC_FILE_PATHS=(DESCRIPTION LICENSE NAMESPACE NEWS.md README.md inst/CITATION)

# Get files from directories
FILES=$(find "${SRC_FOLDER_PATHS[@]}" -type f)
#!/bin/bash

# Add indicated individual files
for F in "${SRC_FILE_PATHS[@]}"
do
FILES+=" ${F}"
done
# Designate desired directories and files
FILES=(
'data-raw/'*
'man/'*
'R/'*
'tests/'*
'vignettes/'*
'DESCRIPTION'
'NAMESPACE'
'NEWS.md'
'README.md'
'inst/CITATION'
)

echo "${FILES[@]}"

Expand All @@ -22,7 +25,9 @@ git fetch
git checkout $TARGET_BRANCH
# copy files from the branch the action is being run upon
SRC_BRANCH=$(git symbolic-ref --short HEAD)
git checkout $SRC_BRANCH -- $FILES
for F in ${FILES}; do
git checkout $SRC_BRANCH -- ${F}
done
# Commit to the repository (ignore if no changes)
git add -A
git diff-index --quiet HEAD || git commit -am "update files"
Expand Down

0 comments on commit ffff4c6

Please sign in to comment.