From 7d8cb546b7540bb6bdc7c7ced8c8bfca8e65aec0 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 11:33:52 -0700 Subject: [PATCH 01/22] First pass at Linguist automation --- .github/workflows/sync-linguist.yml | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/sync-linguist.yml diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml new file mode 100644 index 0000000..dbadec4 --- /dev/null +++ b/.github/workflows/sync-linguist.yml @@ -0,0 +1,58 @@ +name: Sync Linguist +on: workflow_dispatch + +jobs: + sync-linguist: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + - uses: actions/checkout@v2 + - name: Create a branch + run: git checkout -b feature/sync-linguist-$(date +%s) + - uses: actions/checkout@v2 + with: + repository: github/linguist + path: .linguist + fetch-depth: 0 + - name: check out latest release + id: linguist-release + run: | + set -e + cd .linguist + $latest=$(git tag --list | \ + grep -v "-" | \ # exclude any pre-release versions + sort --version-sort --reverse | \ + head -1) + echo "::set-output name=linguist_version::$latest" + git checkout $latest + cd .. + - name: Generate code + run: make code-generate + - name: Commit changes + id: commit + run: | + set -e + if [[ -n "$(git status --porcelain)" ]]; then + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "Updated Linguist to ${{ steps.linguist-release.outputs.linguist_version }}" + git push + echo "::set-output name=needs_pr::true" + else + echo "::set-output name=needs_pr::false" + fi + - name: Create Pull Request + id: open-pr + uses: repo-sync/pull-request@v2 + if: ${{ steps.commit.needs_pr == 'true' }} + with: + destination_branch: "master" + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: output-url + if: ${{ steps.commit.needs_pr == 'true' }} + run: echo ${{ steps.open-pr.outputs.pr_url }} + - name: No PR Created + if: ${{ steps.commit.needs_pr == 'false' }} + run: echo "No changes for ${{ steps.linguist-release.outputs.linguist_version }}" + \ No newline at end of file From 0d5322628e807db89490ae7082f85e1d24ea87f2 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 11:42:59 -0700 Subject: [PATCH 02/22] remove comment from shell pipeline --- .github/workflows/sync-linguist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index dbadec4..93d20af 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -16,11 +16,13 @@ jobs: fetch-depth: 0 - name: check out latest release id: linguist-release + # the `grep -v "-"` is to exclude any pre-release versions. + # Linguist doesn't have any right now, but just in case. run: | set -e cd .linguist $latest=$(git tag --list | \ - grep -v "-" | \ # exclude any pre-release versions + grep -v "-" | \ sort --version-sort --reverse | \ head -1) echo "::set-output name=linguist_version::$latest" From e86c6b862fc3d564427080ce8ba1d52f28e2c854 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 11:46:12 -0700 Subject: [PATCH 03/22] correct variable assignment --- .github/workflows/sync-linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 93d20af..365a0a7 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -21,7 +21,7 @@ jobs: run: | set -e cd .linguist - $latest=$(git tag --list | \ + latest=$(git tag --list | \ grep -v "-" | \ sort --version-sort --reverse | \ head -1) From 3fae59fb31b4ffa98e7cf9c3cc6017a500ee8f7f Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 11:55:06 -0700 Subject: [PATCH 04/22] improve error handling, save branch name for push --- .github/workflows/sync-linguist.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 365a0a7..816337f 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -8,7 +8,13 @@ jobs: - uses: actions/setup-go@v2 - uses: actions/checkout@v2 - name: Create a branch - run: git checkout -b feature/sync-linguist-$(date +%s) + id: branch + run: | + set -euo pipefail + IFS=$'\n\t' + branch_name=$(feature/sync-linguist-$(date +%s)) + git checkout -b $branch_name + echo "::set-output name=branch_name::$branch_name" - uses: actions/checkout@v2 with: repository: github/linguist @@ -19,7 +25,8 @@ jobs: # the `grep -v "-"` is to exclude any pre-release versions. # Linguist doesn't have any right now, but just in case. run: | - set -e + set -euo pipefail + IFS=$'\n\t' cd .linguist latest=$(git tag --list | \ grep -v "-" | \ @@ -33,13 +40,14 @@ jobs: - name: Commit changes id: commit run: | - set -e + set -euo pipefail + IFS=$'\n\t' if [[ -n "$(git status --porcelain)" ]]; then git config user.name github-actions git config user.email github-actions@github.com git add . git commit -m "Updated Linguist to ${{ steps.linguist-release.outputs.linguist_version }}" - git push + git push --set-upstream origin ${{ steps.branch.outputs.branch_name }} echo "::set-output name=needs_pr::true" else echo "::set-output name=needs_pr::false" From f0b2a73b5baded8f0c1b5914bc7af25bb7a8eb12 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 11:56:56 -0700 Subject: [PATCH 05/22] fix branch_name --- .github/workflows/sync-linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 816337f..0c86233 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -12,7 +12,7 @@ jobs: run: | set -euo pipefail IFS=$'\n\t' - branch_name=$(feature/sync-linguist-$(date +%s)) + branch_name=feature/sync-linguist-$(date +%s) git checkout -b $branch_name echo "::set-output name=branch_name::$branch_name" - uses: actions/checkout@v2 From 7def8c82ced59cd7acf6acfdccd589cdb1833b9d Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 12:20:28 -0700 Subject: [PATCH 06/22] this shouldn't be required to stop the workflow --- .github/workflows/sync-linguist.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 0c86233..a30acd7 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -11,7 +11,7 @@ jobs: id: branch run: | set -euo pipefail - IFS=$'\n\t' + IFS=$'\n\t' branch_name=feature/sync-linguist-$(date +%s) git checkout -b $branch_name echo "::set-output name=branch_name::$branch_name" @@ -32,6 +32,11 @@ jobs: grep -v "-" | \ sort --version-sort --reverse | \ head -1) + if [[ $? -ne 0 ]]; then + echo "Could not find latest tagged Linguist version" + exit 1 + fi + echo "::set-output name=linguist_version::$latest" git checkout $latest cd .. From c6f7913c280bf6a8c20f787f50bcae3aa155deb7 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 14:10:59 -0700 Subject: [PATCH 07/22] remove extra whitespace, check $latest --- .github/workflows/sync-linguist.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index a30acd7..a63d701 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -29,14 +29,13 @@ jobs: IFS=$'\n\t' cd .linguist latest=$(git tag --list | \ - grep -v "-" | \ + grep -v "-" | \ sort --version-sort --reverse | \ head -1) - if [[ $? -ne 0 ]]; then - echo "Could not find latest tagged Linguist version" + if [[ -n $latest ]]; then + echo "could not determine latest Linguist version" exit 1 fi - echo "::set-output name=linguist_version::$latest" git checkout $latest cd .. From 8b3fc58258cbf966a3855c4ba8b9c89dbf4b0f5a Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 14:14:32 -0700 Subject: [PATCH 08/22] sigh use -z --- .github/workflows/sync-linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index a63d701..c6c40f6 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -32,7 +32,7 @@ jobs: grep -v "-" | \ sort --version-sort --reverse | \ head -1) - if [[ -n $latest ]]; then + if [[ -z $latest ]]; then echo "could not determine latest Linguist version" exit 1 fi From 202ca6a675c888f3c844d98fd698aef331a2a30c Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 14:27:46 -0700 Subject: [PATCH 09/22] tweak commit step for debugging --- .github/workflows/sync-linguist.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index c6c40f6..4fb4eb9 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -46,16 +46,22 @@ jobs: run: | set -euo pipefail IFS=$'\n\t' + echo "git current state:" + git status + if [[ -n "$(git status --porcelain)" ]]; then + echo "Creating Linguist update commit" git config user.name github-actions git config user.email github-actions@github.com git add . git commit -m "Updated Linguist to ${{ steps.linguist-release.outputs.linguist_version }}" git push --set-upstream origin ${{ steps.branch.outputs.branch_name }} echo "::set-output name=needs_pr::true" - else - echo "::set-output name=needs_pr::false" + exit 0 fi + + echo "Linguist update unncessary" + echo "::set-output name=needs_pr::false" - name: Create Pull Request id: open-pr uses: repo-sync/pull-request@v2 @@ -67,6 +73,6 @@ jobs: if: ${{ steps.commit.needs_pr == 'true' }} run: echo ${{ steps.open-pr.outputs.pr_url }} - name: No PR Created - if: ${{ steps.commit.needs_pr == 'false' }} + if: ${{ steps.commit.needs_pr != 'true' }} run: echo "No changes for ${{ steps.linguist-release.outputs.linguist_version }}" \ No newline at end of file From 73a29fd3246d00fced0b187ceb836f46d31102ba Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 14:39:00 -0700 Subject: [PATCH 10/22] add a tag override for testing --- .github/workflows/sync-linguist.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 4fb4eb9..ed562c3 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -1,5 +1,11 @@ name: Sync Linguist -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + linguist_tag: + description: 'Linguist tag override' + required: False + default: '' jobs: sync-linguist: @@ -28,10 +34,16 @@ jobs: set -euo pipefail IFS=$'\n\t' cd .linguist - latest=$(git tag --list | \ - grep -v "-" | \ - sort --version-sort --reverse | \ - head -1) + if [[ -n "${{ github.event.inputs.linguist_tag }}" ]]; then + echo "Using tag override '${{ github.event.inputs.linguist_tag }}'" + latest="${{ github.event.inputs.linguist_tag }}" + else + latest=$(git tag --list | \ + grep -v "-" | \ + sort --version-sort --reverse | \ + head -1) + fi + if [[ -z $latest ]]; then echo "could not determine latest Linguist version" exit 1 From 91df2121b1bc4b50b5abbc09a31bd6df5bf1c784 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 14:50:08 -0700 Subject: [PATCH 11/22] try true rather than 'true' --- .github/workflows/sync-linguist.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index ed562c3..8bc3c98 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -68,6 +68,7 @@ jobs: git add . git commit -m "Updated Linguist to ${{ steps.linguist-release.outputs.linguist_version }}" git push --set-upstream origin ${{ steps.branch.outputs.branch_name }} + echo "Changes committed. Will create PR." echo "::set-output name=needs_pr::true" exit 0 fi @@ -77,14 +78,14 @@ jobs: - name: Create Pull Request id: open-pr uses: repo-sync/pull-request@v2 - if: ${{ steps.commit.needs_pr == 'true' }} + if: ${{ steps.commit.needs_pr == true }} with: destination_branch: "master" github_token: ${{ secrets.GITHUB_TOKEN }} - name: output-url - if: ${{ steps.commit.needs_pr == 'true' }} + if: ${{ steps.commit.needs_pr == true }} run: echo ${{ steps.open-pr.outputs.pr_url }} - name: No PR Created - if: ${{ steps.commit.needs_pr != 'true' }} + if: ${{ steps.commit.needs_pr != true }} run: echo "No changes for ${{ steps.linguist-release.outputs.linguist_version }}" \ No newline at end of file From 18ba08ce223311340f423f53234de3d94a817ff6 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 14:53:47 -0700 Subject: [PATCH 12/22] need outputs --- .github/workflows/sync-linguist.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 8bc3c98..99fdcc4 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -78,12 +78,12 @@ jobs: - name: Create Pull Request id: open-pr uses: repo-sync/pull-request@v2 - if: ${{ steps.commit.needs_pr == true }} + if: ${{ steps.commit.outputs.needs_pr == 'true' }} with: destination_branch: "master" github_token: ${{ secrets.GITHUB_TOKEN }} - name: output-url - if: ${{ steps.commit.needs_pr == true }} + if: ${{ steps.commit.outputs.needs_pr == 'true' }} run: echo ${{ steps.open-pr.outputs.pr_url }} - name: No PR Created if: ${{ steps.commit.needs_pr != true }} From dc3050050521e30084c173a92408df64920617ed Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 15:00:53 -0700 Subject: [PATCH 13/22] set source branch for PR --- .github/workflows/sync-linguist.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 99fdcc4..4a752a8 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -80,6 +80,8 @@ jobs: uses: repo-sync/pull-request@v2 if: ${{ steps.commit.outputs.needs_pr == 'true' }} with: + source_branch: ${{ steps.branch.outputs.branch_name }} + pr_body: "Automated Linguist update :robot:" destination_branch: "master" github_token: ${{ secrets.GITHUB_TOKEN }} - name: output-url From e5a59053d9a731d58f4f4083859988afa91db12b Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 15:05:56 -0700 Subject: [PATCH 14/22] newline --- .github/workflows/sync-linguist.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 4a752a8..d66113b 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -90,4 +90,3 @@ jobs: - name: No PR Created if: ${{ steps.commit.needs_pr != true }} run: echo "No changes for ${{ steps.linguist-release.outputs.linguist_version }}" - \ No newline at end of file From 12d12a6568fdb4d3da8834cefb7d273c6d758e06 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 15:14:36 -0700 Subject: [PATCH 15/22] Run once a day --- .github/workflows/sync-linguist.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index d66113b..7066e83 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -6,6 +6,9 @@ on: description: 'Linguist tag override' required: False default: '' + schedule: + # Run once a day to check for new Linguist updates automatically + - cron: '0 20 * * *' jobs: sync-linguist: From da43eff66d99df06432dd2112cef83084bc35c05 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 15:18:02 -0700 Subject: [PATCH 16/22] Add PR title --- .github/workflows/sync-linguist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 7066e83..69ad0ba 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -84,6 +84,7 @@ jobs: if: ${{ steps.commit.outputs.needs_pr == 'true' }} with: source_branch: ${{ steps.branch.outputs.branch_name }} + pr_title: "Update Linguist to ${{ steps.linguist-release.outputs.linguist_version }}" pr_body: "Automated Linguist update :robot:" destination_branch: "master" github_token: ${{ secrets.GITHUB_TOKEN }} From bd95ff290b9606de4fe288701400b2ae465f0f27 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Fri, 8 Oct 2021 15:59:21 -0700 Subject: [PATCH 17/22] Update linguist commit --- .github/workflows/sync-linguist.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 69ad0ba..2601a75 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -47,13 +47,26 @@ jobs: head -1) fi - if [[ -z $latest ]]; then + if [[ -z "$latest" ]]; then echo "could not determine latest Linguist version" exit 1 fi + echo "::set-output name=linguist_version::$latest" git checkout $latest + + commit=$(git rev-parse HEAD) + if [[ -z "$commit" ]]; then + echo "could not determine latest Linguist commit" + exit 1 + fi + + echo "::set-output name=linguist_commit::$commit" + cd .. + - name: Update Linguist commit + run: | + sed --in-place --regexp-extended 's/(commit[[:space:]]+=[[:space:]])("[a-f0-9]{40}")/\1"${{ steps.linguist-release.outputs.linguist_commit }}"/' internal/code-generator/generator/generator_test.go - name: Generate code run: make code-generate - name: Commit changes From fa3f723873401b37a9eae90459bc365847dad0e6 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Mon, 1 Nov 2021 16:06:41 -0700 Subject: [PATCH 18/22] Improve PR body with release notes and compare view --- .github/workflows/sync-linguist.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 2601a75..faf48d9 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -16,6 +16,13 @@ jobs: steps: - uses: actions/setup-go@v2 - uses: actions/checkout@v2 + - name: Find previous Linguist commit + id: previous_linguist + run: | + set -euo pipefail + IFS=$'\n\t' + commit=$(sed --quiet --regexp-extended 's/[[:space:]]+commit[[:space:]]+=[[:space:]]"([a-f0-9]{40})"/\1/p' internal/code-generator/generator/generator_test.go) + echo "::set-output name=commit::$commit" - name: Create a branch id: branch run: | @@ -98,7 +105,13 @@ jobs: with: source_branch: ${{ steps.branch.outputs.branch_name }} pr_title: "Update Linguist to ${{ steps.linguist-release.outputs.linguist_version }}" - pr_body: "Automated Linguist update :robot:" + pr_body: | + Automated Linguist update :robot: + + This PR updates Linguist from [${{ steps.previous_linguist.outputs.commit }}](https://github.com/github/linguist/commit/${{ steps.previous_linguist.outputs.commit }}) to [${{ steps.linguist-release.outputs.linguist_version }}](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) ([${{ steps.linguist-release.outputs.linguist_commit }}](https://github.com/github/linguist/commit/${{ steps.linguist-release.outputs.linguist_commit }})) + + * [Linguist release notes](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }} + * [Compare Linguist code changes](https://github.com/github/linguist/compare/${{ steps.previous_linguist.outputs.commit }}...${{ steps.linguist-release.outputs.linguist_version }}) destination_branch: "master" github_token: ${{ secrets.GITHUB_TOKEN }} - name: output-url From 9c452db16f8c85bfa1eec2880021475461ba125e Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Mon, 1 Nov 2021 16:10:22 -0700 Subject: [PATCH 19/22] fix link --- .github/workflows/sync-linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index faf48d9..64fcd7b 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -110,7 +110,7 @@ jobs: This PR updates Linguist from [${{ steps.previous_linguist.outputs.commit }}](https://github.com/github/linguist/commit/${{ steps.previous_linguist.outputs.commit }}) to [${{ steps.linguist-release.outputs.linguist_version }}](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) ([${{ steps.linguist-release.outputs.linguist_commit }}](https://github.com/github/linguist/commit/${{ steps.linguist-release.outputs.linguist_commit }})) - * [Linguist release notes](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }} + * [Linguist release notes](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) * [Compare Linguist code changes](https://github.com/github/linguist/compare/${{ steps.previous_linguist.outputs.commit }}...${{ steps.linguist-release.outputs.linguist_version }}) destination_branch: "master" github_token: ${{ secrets.GITHUB_TOKEN }} From f0dd1b49080a547436b4967a3b37bd53fa68ae12 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Mon, 1 Nov 2021 16:16:05 -0700 Subject: [PATCH 20/22] short commit for easier to read output --- .github/workflows/sync-linguist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 64fcd7b..274be3c 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -23,6 +23,7 @@ jobs: IFS=$'\n\t' commit=$(sed --quiet --regexp-extended 's/[[:space:]]+commit[[:space:]]+=[[:space:]]"([a-f0-9]{40})"/\1/p' internal/code-generator/generator/generator_test.go) echo "::set-output name=commit::$commit" + echo "::set-output name=short_commit::${commit::8}" - name: Create a branch id: branch run: | @@ -69,6 +70,7 @@ jobs: fi echo "::set-output name=linguist_commit::$commit" + echo "::set-output name=short_linguist_commit::${commit::8}" cd .. - name: Update Linguist commit @@ -108,7 +110,7 @@ jobs: pr_body: | Automated Linguist update :robot: - This PR updates Linguist from [${{ steps.previous_linguist.outputs.commit }}](https://github.com/github/linguist/commit/${{ steps.previous_linguist.outputs.commit }}) to [${{ steps.linguist-release.outputs.linguist_version }}](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) ([${{ steps.linguist-release.outputs.linguist_commit }}](https://github.com/github/linguist/commit/${{ steps.linguist-release.outputs.linguist_commit }})) + This PR updates Linguist from `[${{ steps.previous_linguist.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.previous_linguist.outputs.commit }})` to [${{ steps.linguist-release.outputs.linguist_version }}](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) (`[${{ steps.linguist-release.outputs.short_linguist_commit }}](https://github.com/github/linguist/commit/${{ steps.linguist-release.outputs.linguist_commit }})`) * [Linguist release notes](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) * [Compare Linguist code changes](https://github.com/github/linguist/compare/${{ steps.previous_linguist.outputs.commit }}...${{ steps.linguist-release.outputs.linguist_version }}) From d10b372338eddcb6b2f13d21b2645e3a843886b1 Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Mon, 1 Nov 2021 16:17:15 -0700 Subject: [PATCH 21/22] harmonize naming --- .github/workflows/sync-linguist.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index 274be3c..d10447a 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -69,13 +69,13 @@ jobs: exit 1 fi - echo "::set-output name=linguist_commit::$commit" - echo "::set-output name=short_linguist_commit::${commit::8}" + echo "::set-output name=commit::$commit" + echo "::set-output name=short_commit::${commit::8}" cd .. - name: Update Linguist commit run: | - sed --in-place --regexp-extended 's/(commit[[:space:]]+=[[:space:]])("[a-f0-9]{40}")/\1"${{ steps.linguist-release.outputs.linguist_commit }}"/' internal/code-generator/generator/generator_test.go + sed --in-place --regexp-extended 's/(commit[[:space:]]+=[[:space:]])("[a-f0-9]{40}")/\1"${{ steps.linguist-release.outputs.commit }}"/' internal/code-generator/generator/generator_test.go - name: Generate code run: make code-generate - name: Commit changes @@ -110,7 +110,7 @@ jobs: pr_body: | Automated Linguist update :robot: - This PR updates Linguist from `[${{ steps.previous_linguist.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.previous_linguist.outputs.commit }})` to [${{ steps.linguist-release.outputs.linguist_version }}](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) (`[${{ steps.linguist-release.outputs.short_linguist_commit }}](https://github.com/github/linguist/commit/${{ steps.linguist-release.outputs.linguist_commit }})`) + This PR updates Linguist from `[${{ steps.previous_linguist.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.previous_linguist.outputs.commit }})` to [${{ steps.linguist-release.outputs.linguist_version }}](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) (`[${{ steps.linguist-release.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.linguist-release.outputs.commit }})`) * [Linguist release notes](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) * [Compare Linguist code changes](https://github.com/github/linguist/compare/${{ steps.previous_linguist.outputs.commit }}...${{ steps.linguist-release.outputs.linguist_version }}) From 6f321c1e715ca568ee4f120f3317747b31a458aa Mon Sep 17 00:00:00 2001 From: Luke Francl Date: Mon, 1 Nov 2021 16:21:04 -0700 Subject: [PATCH 22/22] remove `` This runs a CLI so it would need to be escaped --- .github/workflows/sync-linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-linguist.yml b/.github/workflows/sync-linguist.yml index d10447a..5b40aef 100644 --- a/.github/workflows/sync-linguist.yml +++ b/.github/workflows/sync-linguist.yml @@ -110,7 +110,7 @@ jobs: pr_body: | Automated Linguist update :robot: - This PR updates Linguist from `[${{ steps.previous_linguist.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.previous_linguist.outputs.commit }})` to [${{ steps.linguist-release.outputs.linguist_version }}](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) (`[${{ steps.linguist-release.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.linguist-release.outputs.commit }})`) + This PR updates Linguist from [${{ steps.previous_linguist.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.previous_linguist.outputs.commit }}) to [${{ steps.linguist-release.outputs.linguist_version }}](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) ([${{ steps.linguist-release.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.linguist-release.outputs.commit }})) * [Linguist release notes](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) * [Compare Linguist code changes](https://github.com/github/linguist/compare/${{ steps.previous_linguist.outputs.commit }}...${{ steps.linguist-release.outputs.linguist_version }})