From 7472600aa1655781c3023a6f55f5b746c1133337 Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Tue, 9 Jun 2020 15:03:35 +0100 Subject: [PATCH] Update Travis references in scripts --- scripts/build.sh | 4 ++-- scripts/check-pr.sh | 4 ++-- scripts/deploy.sh | 10 +++++----- scripts/send-to-bot.py | 6 +++--- scripts/test.sh | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 75a274b5c..3c56790f3 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -# This script is executed by Travis CI for every successful push (on any branch, PR or not). +# This script is executed by GitHub Actions for every successful push (on any branch, PR or not). set -ex function initialize { if [ -z "$TLDRHOME" ]; then - export TLDRHOME=${TRAVIS_BUILD_DIR:-$(pwd)} + export TLDRHOME=${GITHUB_WORKSPACE:-$(pwd)} fi export TLDR_ARCHIVE="tldr.zip" diff --git a/scripts/check-pr.sh b/scripts/check-pr.sh index 6b914da9d..55d2d0af1 100644 --- a/scripts/check-pr.sh +++ b/scripts/check-pr.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# This script is executed by Travis CI for every pull request opened. +# This script is executed by GitHub Actions for every pull request opened. # It currently accomplishes the following objectives (for English pages only): # # 1. Detect pages that were just copied (i.e. cp pages/{common,linux}/7z.md). @@ -110,7 +110,7 @@ MSG_NOT_MD='The file `%s` does not have a `.md` extension.\n' PLATFORMS=$(ls pages/) -if [ "$TRAVIS" = "true" ] && [ "$TRAVIS_REPO_SLUG" = "tldr-pages/tldr" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then +if [ "$CI" = "true" ] && [ "$GITHUB_REPOSITORY" = "tldr-pages/tldr" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then check_diff check_structure else diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 2aee72417..5a8fb9354 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -# This script is executed by Travis CI when a PR is merged (i.e. in the `deploy` step). +# This script is executed by GitHub Actions when a PR is merged (i.e. in the `deploy` step). set -ex function initialize { if [ -z "$TLDRHOME" ]; then - export TLDRHOME=${TRAVIS_BUILD_DIR:-$(pwd)} + export TLDRHOME=${GITHUB_WORKSPACE:-$(pwd)} fi export TLDR_ARCHIVE="tldr.zip" @@ -13,8 +13,8 @@ function initialize { export SITE_REPO_SLUG="tldr-pages/tldr-pages.github.io" # Configure git. - git config --global user.email "travis@travis-ci.org" - git config --global user.name "Travis CI" + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" git config --global push.default simple git config --global diff.zip.textconv "unzip -c -a" @@ -32,7 +32,7 @@ function upload_assets { cd "$SITE_HOME" git add -A - git commit -m "[TravisCI] uploaded assets after commits ${TRAVIS_COMMIT_RANGE}" + git commit -m "[GitHub Actions] uploaded assets after commits ${TRAVIS_COMMIT_RANGE}" git push -q echo "Assets (pages archive, index) deployed to static site." diff --git a/scripts/send-to-bot.py b/scripts/send-to-bot.py index db1cb3674..93a9e7807 100644 --- a/scripts/send-to-bot.py +++ b/scripts/send-to-bot.py @@ -8,7 +8,7 @@ import urllib.request BOT_URL = 'https://tldr-bot.starbeamrainbowlabs.com' COMMENT_ERROR=""" -The [build](https://travis-ci.org/tldr-pages/tldr/builds/{build_id}) for this PR failed with the following error(s): +The [build](https://github.com/tldr-pages/tldr/actions/runs/{build_id}) for this PR failed with the following error(s): ``` {content} @@ -73,9 +73,9 @@ def main(action): ################################################################################ if __name__ == '__main__': - REPO_SLUG = os.environ.get('TRAVIS_REPO_SLUG') + REPO_SLUG = os.environ.get('GITHUB_REPOSITORY') PR_ID = os.environ.get('TRAVIS_PULL_REQUEST') - BUILD_ID = os.environ.get('TRAVIS_BUILD_ID') + BUILD_ID = os.environ.get('GITHUB_RUN_ID') if PR_ID is None or BUILD_ID is None or REPO_SLUG is None: print('Needed environment variables are not set.', file=sys.stderr) diff --git a/scripts/test.sh b/scripts/test.sh index 97aa158bb..d49294601 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# This script is executed by Travis CI for every successful push (on any branch, PR or not). +# This script is executed by GitHub Actions for every successful push (on any branch, PR or not). # It runs some basic tests on pages. If the build is also a PR, additional # checks are run through the check-pr script, and any message or error is sent # to tldr-bot to be commented on the PR. @@ -14,7 +14,7 @@ function run_tests { tldr-lint ./pages } -# Special test function for Travis CI pull request builds. +# Special test function for GitHub Actions pull request builds. # Runs run_tests collecting errors for tldr-bot. function run_tests_pr { errs=$(run_tests 2>&1) @@ -27,7 +27,7 @@ function run_tests_pr { fi } -# Additional checks for Travis CI pull request builds. +# Additional checks for GitHub Actions pull request builds. # Only taken as suggestions, does not make the build fail. function run_checks_pr { msgs=$(bash scripts/check-pr.sh) @@ -43,7 +43,7 @@ function run_checks_pr { # MAIN ################################### -if [ "$TRAVIS" = "true" ] && [ "$TRAVIS_REPO_SLUG" = "tldr-pages/tldr" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then +if [ "$CI" = "true" ] && [ "$GITHUB_REPOSITORY" = "tldr-pages/tldr" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then run_checks_pr run_tests_pr else