Copy unreleased changelogs to vscode-terraform on merge #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |