Skip to content

Commit

Permalink
Update Travis references in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
owenvoke authored and mebeim committed Jun 26, 2020
1 parent 2126dfe commit 7472600
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-pr.sh
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/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"
export SITE_HOME="$HOME/site"
export SITE_REPO_SLUG="tldr-pages/tldr-pages.github.io"

# Configure git.
git config --global user.email "[email protected]"
git config --global user.name "Travis CI"
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git config --global push.default simple
git config --global diff.zip.textconv "unzip -c -a"

Expand All @@ -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."
Expand Down
6 changes: 3 additions & 3 deletions scripts/send-to-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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}
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 7472600

Please sign in to comment.