From 95293450475abee7d852177c6beffa6b7358f68f Mon Sep 17 00:00:00 2001 From: galiacheng Date: Fri, 22 Oct 2021 13:13:35 +0800 Subject: [PATCH 1/2] On branch main: allow to specify the owner of the repo Signed-off-by: galiacheng --- .github/workflows/newtag.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/newtag.yaml b/.github/workflows/newtag.yaml index d406a6ec5..230368ba2 100644 --- a/.github/workflows/newtag.yaml +++ b/.github/workflows/newtag.yaml @@ -10,6 +10,10 @@ on: description: 'Specify Git Ref if needed.' required: false default: 'refs/heads/main' + owner: + description: 'Specify repository owner.' + required: false + env: tagbranch: "tagbranch" gitToken: ${{ secrets.GIT_TOKEN }} @@ -64,7 +68,13 @@ jobs: git config --global user.email $userEmail git config --global user.name $userName - authGitPath=https://$gitToken@github.com/$userName/${{ env.repoName }}.git + + owner=${{ github.event.inputs.owner }} + if [[ -z "${owner}" ]];then + owner=$userName + fi + + authGitPath=https://$gitToken@github.com/$owner/${{ env.repoName }}.git echo "Create tag branch" remoteBranches=$(git ls-remote --heads) From 4801ef68146cc63d33e4943d0b1bd659dfd560bf Mon Sep 17 00:00:00 2001 From: galiacheng Date: Fri, 22 Oct 2021 13:44:00 +0800 Subject: [PATCH 2/2] On branch main: remove owner. Signed-off-by: galiacheng --- .github/workflows/newtag.yaml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/newtag.yaml b/.github/workflows/newtag.yaml index 230368ba2..a5962ac1b 100644 --- a/.github/workflows/newtag.yaml +++ b/.github/workflows/newtag.yaml @@ -10,9 +10,6 @@ on: description: 'Specify Git Ref if needed.' required: false default: 'refs/heads/main' - owner: - description: 'Specify repository owner.' - required: false env: tagbranch: "tagbranch" @@ -67,14 +64,8 @@ jobs: git config --global core.longpaths true git config --global user.email $userEmail git config --global user.name $userName - - - owner=${{ github.event.inputs.owner }} - if [[ -z "${owner}" ]];then - owner=$userName - fi - authGitPath=https://$gitToken@github.com/$owner/${{ env.repoName }}.git + authGitPath=https://$gitToken@github.com/${GITHUB_REPOSITORY}.git echo "Create tag branch" remoteBranches=$(git ls-remote --heads)