diff --git a/.changes/unreleased/INTERNAL-20240722-152532.yaml b/.changes/unreleased/INTERNAL-20240722-152532.yaml new file mode 100644 index 00000000..fca989dd --- /dev/null +++ b/.changes/unreleased/INTERNAL-20240722-152532.yaml @@ -0,0 +1,6 @@ +kind: INTERNAL +body: Copy unreleased changelogs to vscode-terrafor on PR merge +time: 2024-07-22T15:25:32.261657-04:00 +custom: + Issue: "1775" + Repository: terraform-ls diff --git a/.github/workflows/copy-changelog.yml b/.github/workflows/copy-changelog.yml new file mode 100644 index 00000000..32941fa3 --- /dev/null +++ b/.github/workflows/copy-changelog.yml @@ -0,0 +1,49 @@ +# This workflow copies the changelog entries from terraform-ls to vscode-terraform +# when a PR is merged. +# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-pull_request-workflow-when-a-pull-request-merges +# https://github.com/actions/checkout?tab=readme-ov-file#checkout-multiple-repos-side-by-side +name: Copy changelog to vscode-terraform + +on: + pull_request: + types: + - closed + +permissions: + pull-requests: write # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs#defining-access-for-the-github_token-scopes + +jobs: + update_vscode_terraform_changelog: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + path: terraform-ls + + - name: Checkout tools repo + uses: actions/checkout@v4 + with: + repository: hashicorp/vscode-terraform + path: vscode-terraform + + - name: Copy changelog entry + run: | + cp terraform-ls/.changes/unreleased/*.yaml vscode-terraform/.changes/unreleased/ + + - name: Commit changelog entry + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd ./vscode-terraform + git config --global user.name "${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}" + git config --global user.email "${{ vars.TF_DEVEX_CI_COMMIT_EMAIL }}" + git add .changes/unreleased/*.yaml + git commit -m "Copy changelog entries from terraform-ls" + + # direct push + # git push "https://${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}:${{ secrets.TF_DEVEX_COMMIT_GITHUB_TOKEN }}@github.com/hashicorp/vscode-terraform.git" + + # pull request + # gh pr create -B main -H branch_to_merge --fill