Skip to content

Commit f701255

Browse files
committed
use bash scripts for bundle copy and push in GH action
1 parent f952cd8 commit f701255

File tree

3 files changed

+59
-11
lines changed

3 files changed

+59
-11
lines changed

.github/scripts/copy-ectd-bundle.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail # strict mode
3+
readonly SCRIPT_NAME="$(basename "$0")"
4+
readonly SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
5+
function l { # Log a message to the terminal.
6+
echo
7+
echo -e "[$SCRIPT_NAME] ${1:-}"
8+
}
9+
10+
# ECTD file to copy from source repo
11+
ECTD_BUNDLE_DIR=./submissions-pilot4-webR/ectd_bundle
12+
ECTD_BUNDLE_FILE=r4app.zip
13+
14+
if [ -f "$ECTD_BUNDLE_FILE" ]; then
15+
echo "Copying ${ECTD_BUNDLE_FILE}"
16+
if [ -f "$DESTINATION_DIR" ]; then
17+
mkdir -p "${DESTINATION_DIR}"
18+
fi
19+
cp "${ECTD_BUNDLE_DIR}/${ECTD_BUNDLE_FILE}" "${DESTINATION_DIR}/${ECTD_BUNDLE_FILE}"
20+
fi
21+
22+
echo "ECTD Bundle file copied to ${DESTINATION_DIR}/${ECTD_BUNDLE_FILE}"

.github/scripts/push-ectd-bundle.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail # strict mode
3+
readonly SCRIPT_NAME="$(basename "$0")"
4+
readonly SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
5+
function l { # Log a message to the terminal.
6+
echo
7+
echo -e "[$SCRIPT_NAME] ${1:-}"
8+
}
9+
10+
# Set up file paths
11+
ECTD_REPO_DIR=submissions-pilot4-webR-to-fda
12+
13+
# Navigate to clone of ECTD repo
14+
cd "./${ECTD_REPO_DIR}"
15+
echo "Open root of ECTD GitHub Repo"
16+
17+
# Commit updated bundle to repository
18+
git add -A .
19+
git config user.name github-actions
20+
git config user.email github-actions@github.com
21+
git commit -am "GH Action: Update ECTD bundle of application"
22+
git push --set-upstream origin main
23+
24+
echo "Updated ECTD bundle successfully to repository"

.github/workflows/publish-ectd-bundle.yaml

+13-11
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ jobs:
3232
source("utils.R"); create_ectd_bundle()
3333
shell: Rscript {0}
3434

35-
- name: Push ECTD bundle to custom repository
36-
uses: nkoppel/push-files-to-another-repository@v1.1.2
37-
env:
38-
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
35+
- name: Check out ECTD bundle destination repo
36+
uses: actions/checkout@v4
3937
with:
40-
source-files: 'ectd_bundle/r4app.zip'
41-
destination-username: 'RConsortium'
42-
destination-repository: 'submissions-pilot4-webR-to-fda'
43-
destination-branch: 'main'
44-
destination-directory: 'm5/datasets/rconsortiumpilot4webR/analysis/adam/programs'
45-
commit-username: 'rpodcast'
46-
commit-email: 'theRcast@gmail.com'
38+
repository: RConsortium/submissions-pilot4-webR-to-fda
39+
path: ./submissions-pilot4-webR-to-fda
40+
token: ${{ secrets.API_TOKEN_GITHUB }}
41+
42+
- name: Copy ECTD bundle
43+
run: bash ./.github/scripts/copy-ectd-bundle.sh
44+
env:
45+
DESTINATION_DIR: ./submissions-pilot4-webR-to-fda/m5/datasets/rconsortiumpilot4webR/analysis/adam/programs
46+
47+
- name: Push ECTD bundle
48+
run: bash ./.github/scripts/push-ectd-bundle.sh

0 commit comments

Comments
 (0)