Ссылка, предоставленная @banyan, дала информацию, аналогичную приведенной в ответе @zCHIP, которая и была необходима для получения параметра. В основном, чтобы передать $ {{github.ref}}. Он не содержит фактического имени ветки, но содержит ссылку типа "refs / pull / 61 / head". Моя точка входа. Затем сценарию sh нужно было извлечь это в ветку (локально), которую затем можно было бы извлечь.
Хотя, пройдя через это, я заметил, что при запуске контейнера docker GitHub делает передать переменную окружения GITHUB_REF, что на самом деле означает, что мне не нужно go, чтобы самому передавать его в качестве параметра. Я немного почистил файлы, и вот моя финальная версия, которая работает, если кто-то другой пытается это сделать.
Это скрипт действия ccpp - docker .yml в моем реальном проекте, для которого я хочу реализовать CI:
name: C/C++ CI docker
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
JTest_job:
runs-on: ubuntu-latest
name: Full build with tests
# Build Docker container and run the entrypoint.sh script in it
steps:
- name: Build and run
id: build_and_run
uses: faustus123/DockerAction-JANA2@alpha
Вот сценарий action.yml в моем настраиваемом действии, который размещен в специальном репозитории faustus123 / DockerAction-JANA2.
#
# This specifies a custom GitHub action that is used to
# build a Docker image as part of the JANA2 CI.
#
name: 'DockerAction-JANA2'
description: 'Build JANA2 and run JTest plugin'
# This specifies that docker will be used and the Dockerfile that the
# image should be built from.
runs:
using: 'docker'
image: 'Dockerfile'
Вот точка входа. Сценарий sh, размещенный в специальном репозитории faustus123 / DockerAction-JANA2.
#!/bin/bash
#
# This is run from within the temporary janatest container
# that gets built by GitHub as part of a GitHub Action to test
# pull requests and commits to master.
#
# This builds JANA2 using the branch given by the GITHUB_REF
# environment variable (passed in by GitHub when container
# is run). What actually gets passed is not the branch
# name, but a repository reference from GITHUB_REF that looks
# something like "refs/pull/61/merge". This gets fetched from the
# origin into a branch named "CI" which is then checked out.
#
# This also uses the CXX_STANDARD environment variable
# which should be set in the Dockerfile to be consistent with
# whatever the ROOT version used. (See Dockerfile for details.)
echo "--- Checking out JANA for $GITHUB_REF --------------"
cd /opt/JANA2
git fetch origin ${GITHUB_REF}:CI
git checkout CI
echo "--- Building JANA ------------------------------"
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/JANA2/Linux -DCMAKE_CXX_STANDARD=$CXX_STANDARD
make -j8 install
echo "--- Setting up JANA environment ----------------"
export PATH=/opt/JANA2/Linux/bin:${PATH}
export JANA_PLUGIN_PATH=/opt/JANA2/Linux/plugins
echo "PATH=${PATH}"
echo "JANA_PLUGIN_PATH=${JANA_PLUGIN_PATH}"
echo "--- Running JTest plugin -----------------------"
jana -PPLUGINS=JTest -Pjana:nevents=100
echo "--- Running janatests ------------------------------"
janatests
echo "--- Done ---------------------------------------"