From 44591e76c0d271cca75a8046d7a50553f931610a Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Sun, 12 Feb 2023 02:19:25 +0100 Subject: [PATCH] Make the AutoRevision update PR against the tagged branch We need to update AutoRevision.txt in both the stable and master branches, so try to do that automatically. --- .gitattributes | 3 ++- .github/workflows/release.yaml | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 424449a229..04735e626b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,7 +20,8 @@ COPYING text *.h text diff=cpp *.h.in text diff=cpp *.py text diff=python -*.cmd text eol=crlf +*.cmd text +# eol=crlf *.sh text eol=lf *.yaml text *.yml text diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 222dba12ac..d94357066b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,11 +13,21 @@ jobs: - run: git rev-parse --short=5 HEAD > cmake/AutoRevision.txt - run: git describe --tags `git rev-list --tags --max-count=1` >> cmake/AutoRevision.txt - run: cat cmake/AutoRevision.txt + - name: Find target branch + id: branch + # We're running on a tag so have no direct access to the branch. Find it. + # Strip the first 3 components (ref/remotes/username) + run: | + git diff + branch=$(git branch -r --contains HEAD --format '%(refname:strip=3)') + echo Target branch is $branch + echo branch=$branch >> $GITHUB_OUTPUT - name: Create Pull Request uses: peter-evans/create-pull-request@v4.0.4 with: + base: ${{ steps.branch.outputs.branch }} commit-message: "Release update of AutoRevision.txt" - branch: "release/autorevision" + branch: "release/autorevision/{{ steps.branch.outputs.branch }}" title: "Release update of AutoRevision.txt" body: > Automatic changes triggered by a new release.