From 638a84158d71345333d41756785893aa6fd1d737 Mon Sep 17 00:00:00 2001 From: TophrC-dd Date: Thu, 30 May 2024 15:25:32 -0400 Subject: [PATCH] Abandoning the github actions workflow as it requires tokens to be created for the other repository making it a potential risk --- .github/workflows/update_docs.yaml | 25 ------------------------- scripts/update_documentation.sh | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 32 deletions(-) delete mode 100644 .github/workflows/update_docs.yaml diff --git a/.github/workflows/update_docs.yaml b/.github/workflows/update_docs.yaml deleted file mode 100644 index fa2cf3f..0000000 --- a/.github/workflows/update_docs.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: create_release_from_tag - -on: - push: - tags: - - "v*.*.*" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Make script executeable - run: chmod + ./scripts/update_documentation.sh - - name: Checkout Documentation - uses: actions/checkout@v4 - with: - repository: 'TophrC-dd/documentation' - sparse-checkout: 'content/en/serverless/azure_app_services/azure_app_services_linux.md' - path: 'Dataog-documentation' - - name: Update Documentation - run: VERSION=${{ github.ref_name }} ./scripts/update_documentation.sh diff --git a/scripts/update_documentation.sh b/scripts/update_documentation.sh index 146e25e..bf8ae25 100755 --- a/scripts/update_documentation.sh +++ b/scripts/update_documentation.sh @@ -9,25 +9,31 @@ GREEN="\033[0;32m" NC="\033[0;0m" -DOCUMENTATION_REPO_PATH=$GITHUB_WORKSPACE/Dataog-documentation +DOCUMENTATION_REPO_PATH=$HOME/go/src/github.com/DataDog/documentation DOCUMENTATION_FILE=./content/en/serverless/azure_app_services/azure_app_services_linux.md function print_color { printf "$GREEN$1$NC\n" } +print_color "Creating a Github PR to update documentation" + +if [ ! -d $DOCUMENTATION_REPO_PATH ]; then + print_color "Documentation directory does not exist, cloning into $DOCUMENTATION_REPO_PATH" + git clone git@github.com:TophrC-dd/documentation $DOCUMENTATION_REPO_PATH +fi + cd $DOCUMENTATION_REPO_PATH -# Make sure they don't have any local changes - this shouldn't happen as the file is checked out on action execution +# Make sure they don't have any local changes if [ ! -z "$(git status --porcelain)" ]; then print_color "Documentation directory is dirty -- please stash or save your changes and manually create the PR" exit 1 fi -#Configuring a git user -git config --unset-all http.https://github.com/.extraheader -git config user.name github-actions -git config user.email github-actions@github.com +print_color "Pulling latest changes from Github" +git checkout master +git pull print_color "Checking out new branch that has version changes" git checkout -b $USER/bump-aas-wrapper-version-$VERSION @@ -37,7 +43,8 @@ git add $DOCUMENTATION_FILE print_color "Creating commit -- please tap your Yubikey if prompted" git commit -m "Bump AAS-WRAPPER to version $VERSION" git push --set-upstream origin $USER/bump-aas-wrapper-version-$VERSION +dd-pr # Reset documentation repo to clean a state that's tracking master print_color "Resetting documentation git branch to master" -git checkout -B master origin/master +git checkout -B master origin/master \ No newline at end of file