From 6ab2841dbb80bbf8439fc38c2e323065d5c32f0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Mon, 20 Jul 2020 18:56:13 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=20Update=20GitHub=20actions=20(#1746)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 Fix Gitter notification, use development gitter room until next release * 🔥 Remove trigger docs preview step from build-docs workflow as it requires a more privileged token, so it's now triggered by the preview docs watcher * 🔊 Dump context when building to allow debugging how to refactor the Gitter bot --- .github/workflows/build-docs.yml | 6 ------ .github/workflows/publish.yml | 6 ++++++ scripts/gitter_releases_bot.py | 6 +++--- scripts/trigger-docs-preview.sh | 21 --------------------- 4 files changed, 9 insertions(+), 30 deletions(-) delete mode 100644 scripts/trigger-docs-preview.sh diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index c54152699..1bda0429a 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -24,12 +24,6 @@ jobs: with: name: docs-zip-${{ github.sha }} path: ./docs.zip - - name: Trigger Docs Preview - env: - PR: "${{ github.event.number }}" - NAME: "docs-zip-${{ github.sha }}" - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - run: bash ./scripts/trigger-docs-preview.sh - name: Deploy to Netlify uses: nwtgck/actions-netlify@v1.1.5 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e25bf1928..cd63e6c35 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,7 +23,13 @@ jobs: FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }} FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }} run: bash scripts/publish.sh + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" - name: Notify env: GITTER_TOKEN: ${{ secrets.GITTER_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref }} run: bash scripts/notify.sh diff --git a/scripts/gitter_releases_bot.py b/scripts/gitter_releases_bot.py index 4e5b1c3d0..718ddc3b6 100644 --- a/scripts/gitter_releases_bot.py +++ b/scripts/gitter_releases_bot.py @@ -3,14 +3,14 @@ import os import requests -room_id = "5c9c9540d73408ce4fbc1403" # FastAPI -# room_id = "5cc46398d73408ce4fbed233" # Gitter development +# room_id = "5c9c9540d73408ce4fbc1403" # FastAPI +room_id = "5cc46398d73408ce4fbed233" # Gitter development gitter_token = os.getenv("GITTER_TOKEN") assert gitter_token github_token = os.getenv("GITHUB_TOKEN") assert github_token -tag_name = os.getenv("TRAVIS_TAG") +tag_name = os.getenv("TAG") assert tag_name diff --git a/scripts/trigger-docs-preview.sh b/scripts/trigger-docs-preview.sh deleted file mode 100644 index d08d7d49e..000000000 --- a/scripts/trigger-docs-preview.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /usr/bin/env bash - -set -x -set -e - -PR=${PR} - -if [ -z "$PR" ]; then - echo "Not a PR build, skip trigger docs preview" - exit 0 -fi - -NAME=${NAME:?Variable not set} -GITHUB_TOKEN=${GITHUB_TOKEN:?Variable not set} - -curl -v \ - -X POST \ - -H "Authorization: token ${GITHUB_TOKEN}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/tiangolo/fastapi/actions/workflows/preview-docs.yml/dispatches \ - -d '{"ref":"master", "inputs": {"pr": "'"${PR}"'", "name": "'"${NAME}"'"}}'