diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6d28c45a..f644c721 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,16 +17,21 @@ jobs: - name: Run spellchecker run: ./check-spelling.sh + if: ${{ success() }} - name: Install antidote binaries run: curl -Lo antidote.tar.gz https://github.com/nre-learning/antidote-core/releases/download/v0.6.2/antidote-linux-amd64.tar.gz && tar xvzf antidote.tar.gz + if: ${{ success() }} - name: Run antidote validation run: ./antidote validate . + if: ${{ success() }} - name: Check changelog run: ./check-changelog.sh + if: ${{ success() }} - name: Request preview run: ./request-preview.sh + if: ${{ success() }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e704da6..e7ddb7cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## In development +- Migrating from travis to github actions [#344](https://github.com/nre-learning/nrelabs-curriculum/pull/344) - Converged motd banners in crpd, added helper tip for 'cli' command [#343](https://github.com/nre-learning/nrelabs-curriculum/pull/343) - Misc curriculum updates for Antidote 0.7 compatibility [#341](https://github.com/nre-learning/nrelabs-curriculum/pull/341) - Refurbish JSNAPy lesson and move to cRPD [#338](https://github.com/nre-learning/nrelabs-curriculum/pull/338) diff --git a/check-changelog.sh b/check-changelog.sh index b539d340..9501b051 100755 --- a/check-changelog.sh +++ b/check-changelog.sh @@ -1,3 +1,4 @@ + git fetch origin master echo $(git branch) @@ -9,12 +10,18 @@ echo $(cat .git/HEAD) # exit 0 # fi -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; +echo "ENV TO FOLLOW" +echo $(env) + + +if [ "$GITHUB_EVENT_NAME" != "pull_request" ]; then - echo "This is PR build, skipping the changelog check" + echo "This is not a pull request, skipping the changelog check" exit 0 fi +echo "Detecting changes..." +echo $(git diff --name-only $(git rev-parse FETCH_HEAD)) if echo $(git diff --name-only $(git rev-parse FETCH_HEAD)) | grep -w CHANGELOG.md > /dev/null; then echo "Thanks for making a CHANGELOG update!" @@ -22,4 +29,4 @@ if echo $(git diff --name-only $(git rev-parse FETCH_HEAD)) | grep -w CHANGELOG. else echo "No CHANGELOG update found. Please provide update to CHANGELOG for this change." exit 1 -fi \ No newline at end of file +fi diff --git a/request-preview.sh b/request-preview.sh index c38172e8..44f89664 100755 --- a/request-preview.sh +++ b/request-preview.sh @@ -4,20 +4,12 @@ set -e +o pipefail url="https://preview.nrelabs.io/webhook" -# https://docs.travis-ci.com/user/environment-variables/ -echo "TRAVIS_PULL_REQUEST_SHA - $TRAVIS_PULL_REQUEST_SHA" -echo "TRAVIS_COMMIT - $TRAVIS_COMMIT" -echo "TRAVIS_JOB_NUMBER - $TRAVIS_JOB_NUMBER" -echo "TRAVIS_PULL_REQUEST - $TRAVIS_PULL_REQUEST" -echo "TRAVIS_JOB_ID - $TRAVIS_JOB_ID" -echo "TRAVIS_REPO_SLUG - $TRAVIS_REPO_SLUG" -echo "env - $env" -echo "TRAVIS_OS_NAME - $TRAVIS_OS_NAME" -echo "TRAVIS_TAG - $TRAVIS_TAG" -echo "TRAVIS_BRANCH - $TRAVIS_BRANCH" -echo "TRAVIS_PULL_REQUEST_BRANCH - $TRAVIS_PULL_REQUEST_BRANCH" - -if [ "$TRAVIS_PULL_REQUEST" == "false" ]; +echo "ENV TO FOLLOW" +echo $(env) + +PR_ID=$(echo $GITHUB_REF | sed "s/refs\/pull\/\(.*\)\/merge/\1/") + +if [ "$GITHUB_EVENT_NAME" != "pull_request" ]; then echo "Not a PR build, skipping preview" exit 0 @@ -27,13 +19,12 @@ echo "Requesting preview...." curl $url --header "Content-Type: application/json" \ --data "{ - \"branch\":\"$TRAVIS_PULL_REQUEST_BRANCH\", - \"pullRequest\":\"$TRAVIS_PULL_REQUEST\", - \"repoSlug\":\"$TRAVIS_PULL_REQUEST_SLUG\", - \"prSha\":\"$TRAVIS_PULL_REQUEST_SHA\" + \"branch\":\"$GITHUB_HEAD_REF\", + \"pullRequest\":\"$PR_ID\", + \"repoSlug\":\"$GITHUB_REPOSITORY\", + \"prSha\":\"$GITHUB_SHA\" }" - echo "DONE!" exit 0