mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-29 23:24:55 +02:00
Update Travis references in scripts
This commit is contained in:
parent
2126dfec04
commit
7472600aa1
5 changed files with 16 additions and 16 deletions
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/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
|
set -ex
|
||||||
|
|
||||||
function initialize {
|
function initialize {
|
||||||
if [ -z "$TLDRHOME" ]; then
|
if [ -z "$TLDRHOME" ]; then
|
||||||
export TLDRHOME=${TRAVIS_BUILD_DIR:-$(pwd)}
|
export TLDRHOME=${GITHUB_WORKSPACE:-$(pwd)}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export TLDR_ARCHIVE="tldr.zip"
|
export TLDR_ARCHIVE="tldr.zip"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/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):
|
# 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).
|
# 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/)
|
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_diff
|
||||||
check_structure
|
check_structure
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/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
|
set -ex
|
||||||
|
|
||||||
function initialize {
|
function initialize {
|
||||||
if [ -z "$TLDRHOME" ]; then
|
if [ -z "$TLDRHOME" ]; then
|
||||||
export TLDRHOME=${TRAVIS_BUILD_DIR:-$(pwd)}
|
export TLDRHOME=${GITHUB_WORKSPACE:-$(pwd)}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export TLDR_ARCHIVE="tldr.zip"
|
export TLDR_ARCHIVE="tldr.zip"
|
||||||
|
@ -13,8 +13,8 @@ function initialize {
|
||||||
export SITE_REPO_SLUG="tldr-pages/tldr-pages.github.io"
|
export SITE_REPO_SLUG="tldr-pages/tldr-pages.github.io"
|
||||||
|
|
||||||
# Configure git.
|
# Configure git.
|
||||||
git config --global user.email "travis@travis-ci.org"
|
git config --global user.email "actions@github.com"
|
||||||
git config --global user.name "Travis CI"
|
git config --global user.name "GitHub Actions"
|
||||||
git config --global push.default simple
|
git config --global push.default simple
|
||||||
git config --global diff.zip.textconv "unzip -c -a"
|
git config --global diff.zip.textconv "unzip -c -a"
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ function upload_assets {
|
||||||
|
|
||||||
cd "$SITE_HOME"
|
cd "$SITE_HOME"
|
||||||
git add -A
|
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
|
git push -q
|
||||||
|
|
||||||
echo "Assets (pages archive, index) deployed to static site."
|
echo "Assets (pages archive, index) deployed to static site."
|
||||||
|
|
|
@ -8,7 +8,7 @@ import urllib.request
|
||||||
BOT_URL = 'https://tldr-bot.starbeamrainbowlabs.com'
|
BOT_URL = 'https://tldr-bot.starbeamrainbowlabs.com'
|
||||||
|
|
||||||
COMMENT_ERROR="""
|
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}
|
{content}
|
||||||
|
@ -73,9 +73,9 @@ def main(action):
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
if __name__ == '__main__':
|
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')
|
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:
|
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)
|
print('Needed environment variables are not set.', file=sys.stderr)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/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
|
# 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
|
# checks are run through the check-pr script, and any message or error is sent
|
||||||
# to tldr-bot to be commented on the PR.
|
# to tldr-bot to be commented on the PR.
|
||||||
|
@ -14,7 +14,7 @@ function run_tests {
|
||||||
tldr-lint ./pages
|
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.
|
# Runs run_tests collecting errors for tldr-bot.
|
||||||
function run_tests_pr {
|
function run_tests_pr {
|
||||||
errs=$(run_tests 2>&1)
|
errs=$(run_tests 2>&1)
|
||||||
|
@ -27,7 +27,7 @@ function run_tests_pr {
|
||||||
fi
|
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.
|
# Only taken as suggestions, does not make the build fail.
|
||||||
function run_checks_pr {
|
function run_checks_pr {
|
||||||
msgs=$(bash scripts/check-pr.sh)
|
msgs=$(bash scripts/check-pr.sh)
|
||||||
|
@ -43,7 +43,7 @@ function run_checks_pr {
|
||||||
# MAIN
|
# 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_checks_pr
|
||||||
run_tests_pr
|
run_tests_pr
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue