Skip to content
This repository was archived by the owner on Nov 2, 2021. It is now read-only.

Commit dda701b

Browse files
committed
feat(v2): read projectPath from environment variable
1 parent 52390e4 commit dda701b

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

action.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ inputs:
1313
runs:
1414
using: 'docker'
1515
image: 'Dockerfile'
16-
env:
17-
PROJECT_PATH: '${{ inputs.projectPath }}'
1816
args:
1917
- ${{ inputs.customCommand }}
2018
branding:

entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
set -e
44

55
# PROJECT_PATH specifies the subdirectory in the working directory that the Go project is
6-
if [ -z "${PROJECT_PATH}" ]; then
7-
PROJECT_PATH="."
6+
if [ -z "${INPUT_PROJECTPATH}" ]; then
7+
INPUT_PROJECTPATH="."
88
fi
99

10-
cd "${WORKDIR}/${PROJECT_PATH}"
10+
cd "${GITHUB_WORKSPACE}/${INPUT_PROJECTPATH}"
1111

1212
# If a command was specified with `args: "..."`, then run it. Otherwise,
1313
# look for something useful to run.

go1.14/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ LABEL com.github.actions.description="Run Golang commands"
1010
LABEL com.github.actions.icon="box"
1111
LABEL com.github.actions.color="blue"
1212

13+
# Install dep and check sha256 checksum matches for version 0.5.2 https://github.com/golang/dep/releases/tag/v0.5.2
14+
RUN set -eux; \
15+
curl -L -s https://github.com/golang/dep/releases/download/v0.5.2/dep-linux-amd64 -o "$GOPATH/bin/dep"; \
16+
echo "40a78c13753f482208d3f4bea51244ca60a914341050c588dad1f00b1acc116c $GOPATH/bin/dep" | sha256sum -c -; \
17+
chmod +x "${GOPATH}/bin/dep";
18+
1319
COPY entrypoint.sh /entrypoint.sh
1420

1521
ENTRYPOINT ["/entrypoint.sh"]

go1.14/entrypoint.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ fi
88
WORKDIR="${GOPATH}/src/github.com/${IMPORT}"
99

1010
# PROJECT_PATH specifies the subdirectory in the working directory that the Go project is
11-
if [ -z "${PROJECT_PATH}" ]; then
12-
PROJECT_PATH="."
11+
if [ -z "${INPUT_PROJECTPATH}" ]; then
12+
INPUT_PROJECTPATH="."
1313
fi
1414

1515
# Go can only find dependencies if they're under $GOPATH/src.
1616
# GitHub Actions mounts your repository outside of $GOPATH.
1717
# So symlink the repository into $GOPATH, and then cd to it.
1818
mkdir -p "$(dirname "${WORKDIR}")"
1919
ln -s "${PWD}" "${WORKDIR}"
20-
cd "${WORKDIR}/${PROJECT_PATH}"
20+
cd "${WORKDIR}/${INPUT_PROJECTPATH}"
2121

22-
# If a command was specified with `args="..."`, then run it. Otherwise,
22+
# If a command was specified with `args: "..."`, then run it. Otherwise,
2323
# look for something useful to run.
2424
if [ $# -eq 0 ] || [ "$*" = "" ]; then
2525
if [ -r Makefile ]; then

go1.15/entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
set -e
44

55
# PROJECT_PATH specifies the subdirectory in the working directory that the Go project is
6-
if [ -z "${PROJECT_PATH}" ]; then
7-
PROJECT_PATH="."
6+
if [ -z "${INPUT_PROJECTPATH}" ]; then
7+
INPUT_PROJECTPATH="."
88
fi
99

10-
cd "${WORKDIR}/${PROJECT_PATH}"
10+
cd "${GITHUB_WORKSPACE}/${INPUT_PROJECTPATH}"
1111

1212
# If a command was specified with `args: "..."`, then run it. Otherwise,
1313
# look for something useful to run.

0 commit comments

Comments
 (0)