From ec1fe875935c38bd6e894dcec56d415c589f3eb1 Mon Sep 17 00:00:00 2001 From: jatin-jangir-0220 <122791251+jatin-jangir-0220@users.noreply.github.com> Date: Mon, 6 May 2024 18:56:56 +0530 Subject: [PATCH] misc: uniform GitHub action (#5069) * Update azure-devops-issue-sync.yml * Update chart-sync.yaml * Update create-release.yml * Update enterprise-repo-sync.yaml * Update pager-duty-issue-escalate.yaml * Update update-release-notes.yml * Update chart-sync.yaml * Update create-release.yml * Update enterprise-repo-sync.yaml * Update update-release-notes.yml * Update enterprise-repo-sync.yaml --------- Co-authored-by: Prakarsh <71125043+prakarsh-dt@users.noreply.github.com> --- .github/workflows/azure-devops-issue-sync.yml | 6 +++--- .github/workflows/chart-sync.yaml | 6 +++--- .github/workflows/create-release.yml | 6 +++--- .github/workflows/enterprise-repo-sync.yaml | 15 +++++---------- .github/workflows/pager-duty-issue-escalate.yaml | 4 ++-- .github/workflows/update-release-notes.yml | 6 +++--- 6 files changed, 19 insertions(+), 24 deletions(-) diff --git a/.github/workflows/azure-devops-issue-sync.yml b/.github/workflows/azure-devops-issue-sync.yml index c060babb899..c102d36c25a 100644 --- a/.github/workflows/azure-devops-issue-sync.yml +++ b/.github/workflows/azure-devops-issue-sync.yml @@ -13,7 +13,7 @@ jobs: uses: danhellem/github-actions-issue-to-work-item@v2.1 env: ado_token: "${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}" - github_token: "${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" + github_token: "${{ secrets.GH_SYSTEMSDT_TOKEN }}" ado_organization: "DevtronLabs" ado_project: "Devtron" ado_wit: "Bug" @@ -26,7 +26,7 @@ jobs: uses: danhellem/github-actions-issue-to-work-item@v2.1 env: ado_token: "${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}" - github_token: "${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" + github_token: "${{ secrets.GH_SYSTEMSDT_TOKEN }}" ado_organization: "DevtronLabs" ado_project: "Devtron" ado_wit: "User Story" @@ -50,7 +50,7 @@ jobs: steps: - uses: wow-actions/potential-duplicates@v1 with: - GITHUB_TOKEN: "${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" + GITHUB_TOKEN: "${{ secrets.GH_SYSTEMSDT_TOKEN }}" # Issue title filter work with anymatch https://www.npmjs.com/package/anymatch. # Any matched issue will stop detection immediately. # You can specify multi filters in each line. diff --git a/.github/workflows/chart-sync.yaml b/.github/workflows/chart-sync.yaml index 14626ae9f3a..b353974e419 100644 --- a/.github/workflows/chart-sync.yaml +++ b/.github/workflows/chart-sync.yaml @@ -27,9 +27,9 @@ jobs: script-file: ${{ secrets.CHART_SYNC_SCRIPT_FILE }} git-target-repo: ${{ secrets.GIT_TARGET_REPO }} git-source-repo: ${{ secrets.GIT_SOURCE_REPO }} - git-target-useremail: ${{ secrets.GIT_TARGET_EMAIL }} - git-target-username: ${{ secrets.GIT_TARGET_USERNAME }} - git-target-token: ${{ secrets.GIT_TARGET_TOKEN }} + git-target-useremail: ${{ secrets.GH_SYSTEMSDT_EMAIL }} + git-target-username: ${{ vars.GH_SYSTEMSDT_USERNAME }} + git-target-token: ${{ secrets.GH_SYSTEMSDT_TOKEN }} git-target-dir: ${{ secrets.GIT_TARGET_DIR }} git-source-dir: ${{ secrets.GIT_SOURCE_DIR }} working-dir: ${{ secrets.WORKING_DIR }} diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index f5766fde603..14d1400a59e 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -62,10 +62,10 @@ jobs: echo "Not creating release due to beta" fi env: - GH_TOKEN: ${{ secrets.GIT_TOKEN }} + GH_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }} RELEASE_BRANCH: ${{ secrets.RELEASE_BRANCH }} - GIT_CONFIG_NAME: ${{ secrets.GIT_TARGET_USERNAME }} - GIT_CONFIG_EMAIL: ${{ secrets.GIT_TARGET_EMAIL }} + GIT_CONFIG_NAME: ${{ vars.GH_SYSTEMSDT_USERNAME }} + GIT_CONFIG_EMAIL: ${{ secrets.GH_SYSTEMSDT_EMAIL }} # Send notification on discord - name: discord-notify run: | diff --git a/.github/workflows/enterprise-repo-sync.yaml b/.github/workflows/enterprise-repo-sync.yaml index 305a3815b96..4b12f4798ea 100644 --- a/.github/workflows/enterprise-repo-sync.yaml +++ b/.github/workflows/enterprise-repo-sync.yaml @@ -14,27 +14,26 @@ jobs: sync: runs-on: ubuntu-latest steps: - - run: | + - env: + GH_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }} + GIT_CONFIG_NAME: ${{ vars.GH_SYSTEMSDT_USERNAME }} + GIT_CONFIG_EMAIL: ${{ secrets.GH_SYSTEMSDT_EMAIL }} + run: | export GIT_USERNAME="${GIT_CONFIG_NAME}" export GIT_PASSWORD="${GH_TOKEN}" export ENTERPRISE_REPO="https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/devtron-labs/devtron-enterprise.git" git clone https://github.com/devtron-labs/devtron git clone $ENTERPRISE_REPO - cd devtron && export GIT_COMMIT_ID=`git log --format="%H" -n 1` - export GIT_COMMIT=${GIT_COMMIT_ID:0:8} echo $GIT_COMMIT git config --global user.email $GIT_CONFIG_EMAIL git config --global user.name $GIT_USERNAME - git status && git checkout main && git pull - cd ../devtron-enterprise && git status && git checkout main && git pull git remote add oss-devtron ../devtron && git remote -v && git remote update && git merge oss-devtron/main export WIRE_GEN_FILE_NAME="wire_gen.go" export CONFLICT_FILES=`git diff --name-only --diff-filter=U --relative` - if [[ $WIRE_GEN_FILE_NAME = $CONFLICT_FILES ]] then rm $WIRE_GEN_FILE_NAME @@ -49,7 +48,3 @@ jobs: git checkout -b oss-enterprise-sync-$GIT_COMMIT && git push -u origin oss-enterprise-sync-$GIT_COMMIT PR_RESPONSE=$(gh pr create --title "SYNC: OSS sync for $GIT_COMMIT" --fill --base main --head oss-enterprise-sync-$GIT_COMMIT --repo $ENTERPRISE_REPO) echo "FINAL PR RESPONSE: $PR_RESPONSE" - env: - GH_TOKEN: ${{ secrets.GIT_TARGET_TOKEN }} - GIT_CONFIG_NAME: ${{ secrets.GIT_TARGET_USERNAME }} - GIT_CONFIG_EMAIL: ${{ secrets.GIT_TARGET_EMAIL }} diff --git a/.github/workflows/pager-duty-issue-escalate.yaml b/.github/workflows/pager-duty-issue-escalate.yaml index 30a1cadf418..cd031d56f8d 100644 --- a/.github/workflows/pager-duty-issue-escalate.yaml +++ b/.github/workflows/pager-duty-issue-escalate.yaml @@ -15,7 +15,7 @@ jobs: - name: List issues with 'pager-duty' label env: - GITHUB_TOKEN: ${{ secrets.GIT_TARGET_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }} run: | issues=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "Accept: application/vnd.github.v3+json" \ @@ -39,7 +39,7 @@ jobs: assignee3="vivek-devtron" curl -X POST \ - -H "Authorization: token ${{ secrets.GIT_TARGET_TOKEN }}" \ + -H "Authorization: token ${{ secrets.GH_SYSTEMSDT_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ -d "{\"assignees\": [\"$assignee1\", \"$assignee2\", \"$assignee3\"]}" \ "https://api.github.com/repos/${{ github.repository }}/issues/$issue_number/assignees" diff --git a/.github/workflows/update-release-notes.yml b/.github/workflows/update-release-notes.yml index 797bfc45d10..ed6d35fdac6 100644 --- a/.github/workflows/update-release-notes.yml +++ b/.github/workflows/update-release-notes.yml @@ -57,6 +57,6 @@ jobs: git commit -am "Updated release notes" git push https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} $RELEASE_NOTES_BRANCH env: - GH_TOKEN: ${{ secrets.GIT_TOKEN }} - GIT_CONFIG_NAME: ${{ secrets.GIT_TARGET_USERNAME }} - GIT_CONFIG_EMAIL: ${{ secrets.GIT_TARGET_EMAIL }} + GH_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }} + GIT_CONFIG_NAME: ${{ vars.GH_SYSTEMSDT_USERNAME }} + GIT_CONFIG_EMAIL: ${{ secrets.GH_SYSTEMSDT_EMAIL }}