Skip to content

Commit

Permalink
Change hyphents in action inputs to underscores
Browse files Browse the repository at this point in the history
The GitHub Action docs
[illustrate](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs)
using hyphens in input names, and then document that names like
`octocat-eye-color` are converted to environment variables like
`INPUT_OCTOCAT-EYE-COLOR`, but these environment variable names
are [not POSIX compliant](https://stackoverflow.com/a/36992531/2019542)
and can't be accessed in many shells.
They've [known about this](actions/toolkit#629) for two years.
Grrrr.
  • Loading branch information
guyer committed May 17, 2023
1 parent 605fd52 commit a266343
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
8 changes: 4 additions & 4 deletions action.yml
Expand Up @@ -6,22 +6,22 @@ inputs:
description:
Subcommand to perform [borg_the_docs, update_pages].
required: true
docs-folder:
docs_folder:
description:
The folder containing your sphinx docs.
required: true
default: "docs/"
default-branch:
default_branch:
description:
The default branch configured in GitHub.
required: false
default: "main"
pages-branch:
pages_branch:
description:
The branch linked to your documentation server.
required: false
default: 'nist-pages'
pages-url:
pages_url:
description:
URL of web server for served documentation.
required: false
Expand Down
14 changes: 4 additions & 10 deletions entrypoint.py
Expand Up @@ -8,21 +8,15 @@

def main():
action = os.environ['INPUT_ACTION']
docs = SphinxDocs(docs_dir=os.environ['INPUT_DOCS-FOLDER'])

# # Install any requirements for documentation.
# # Adapted from ammaraskar/sphinx-action
# requirements = os.path.join(docs.docs_dir, "requirements.txt")
# if os.path.exists(requirements):
# subprocess.check_call(["pip", "install", "-r", requirements])
docs = SphinxDocs(docs_dir=os.environ['INPUT_DOCS_FOLDER'])

if action == 'update_pages':
repo = Repository(server_url=os.environ['GITHUB_SERVER_URL'],
repository=os.environ['GITHUB_REPOSITORY'],
branch=os.environ['INPUT_PAGES-BRANCH'],
default_branch=os.environ['INPUT_DEFAULT-BRANCH'],
branch=os.environ['INPUT_PAGES_BRANCH'],
default_branch=os.environ['INPUT_DEFAULT_BRANCH'],
docs=docs,
pages_url=os.environ['INPUT_PAGES-URL'])
pages_url=os.environ['INPUT_PAGES_URL'])

repo.update_pages(branch=os.environ['SANITIZED_REF_NAME'],
sha=os.environ['GITHUB_SHA'])
Expand Down
10 changes: 5 additions & 5 deletions entrypoint.sh
Expand Up @@ -3,12 +3,12 @@
echo "::error::`env`"
echo "::warning::INPUT_ACTION=${INPUT_ACTION}"
echo "::warning::GITHUB_SHA=${GITHUB_SHA}"
echo "::warning::INPUT_DOCS-FOLDER=${INPUT_DOCS-FOLDER}"
echo "::warning::INPUT_DEFAULT-BRANCH=${INPUT_DEFAULT-BRANCH}"
echo "::warning::INPUT_PAGES-BRANCH=${INPUT_PAGES-BRANCH}"
echo "::warning::INPUT_PAGES-URL=${INPUT_PAGES-URL}"
echo "::warning::INPUT_DOCS_FOLDER=${INPUT_DOCS_FOLDER}"
echo "::warning::INPUT_DEFAULT_BRANCH=${INPUT_DEFAULT_BRANCH}"
echo "::warning::INPUT_PAGES_BRANCH=${INPUT_PAGES_BRANCH}"
echo "::warning::INPUT_PAGES_URL=${INPUT_PAGES_URL}"

requirements="${INPUT_DOCS-FOLDER}/requirements.txt"
requirements="${INPUT_DOCS_FOLDER}/requirements.txt"

echo "::error::requirements=${requirements}"
if [ -f $requirements ];
Expand Down

0 comments on commit a266343

Please sign in to comment.