Skip to content

Commit 71fd73a

Browse files
committed
ci-build: do not deploy when building PRs
If my reading of the GitHub Actions documentation is correct, then organization secrets will be available to pull request builds from a branch of the same repository (as opposed to from a project fork). In that case, we still want the build script to skip deployment, because we don't want to be deploying snapshots from from PRs, only those from the mainline integration branch.
1 parent 5843231 commit 71fd73a

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

ci-build.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ EOL
9393

9494
# --== DEPLOYMENT CHECKS ==--
9595

96-
# Determine whether deploying will be possible.
96+
# Determine whether deploying is both possible and warranted.
9797
echo "Performing deployment checks"
9898
deployOK=
9999

@@ -139,7 +139,12 @@ EOL
139139
fi
140140
;;
141141
esac
142-
deployOK=1
142+
if [ "$BUILD_BASE_REF" -o "$BUILD_HEAD_REF" ]
143+
then
144+
echo "No deploy -- proposed change: $BUILD_BASE_REF -> $BUILD_HEAD_REF"
145+
else
146+
deployOK=1
147+
fi
143148
fi
144149
fi
145150
fi

ci-setup-github-actions.sh

+10-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
# ci-setup-github-actions.sh - Set CI-related environment variables from GitHub Actions.
55
#
66

7-
echo "BUILD_REPOSITORY=https://github.com/${GITHUB_REPOSITORY}"
8-
echo "BUILD_OS=${RUNNER_OS}"
9-
echo "BUILD_DEPLOY_FORBIDDEN=..." # CTR START HERE - use GITHUB-specific env vars set upon PR to decide this
7+
echo "BUILD_REPOSITORY=https://github.com/$GITHUB_REPOSITORY"
8+
echo "BUILD_REPOSITORY=https://github.com/$GITHUB_REPOSITORY" >> $GITHUB_ENV
109

11-
echo "BUILD_REPOSITORY=https://github.com/${GITHUB_REPOSITORY}" >> $GITHUB_ENV
12-
echo "BUILD_OS=${RUNNER_OS}" >> $GITHUB_ENV
10+
echo "BUILD_OS=$RUNNER_OS"
11+
echo "BUILD_OS=$RUNNER_OS" >> $GITHUB_ENV
12+
13+
echo "BUILD_BASE_REF=$GITHUB_BASE_REF"
14+
echo "BUILD_BASE_REF=$GITHUB_BASE_REF" >> $GITHUB_ENV
15+
16+
echo "BUILD_HEAD_REF=$GITHUB_HEAD_REF"
17+
echo "BUILD_HEAD_REF=$GITHUB_HEAD_REF" >> $GITHUB_ENV

0 commit comments

Comments
 (0)