From 3ffb4968dd56c22e29106a7ea06ca3d60b57267a Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 20 Jun 2023 14:34:27 +0000 Subject: [PATCH 1/9] testing --- .github/workflows/main.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8bb2bf12898..bf18450e210 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,6 +20,9 @@ on: # * is a special character in YAML so you have to quote this string # Run this Github Action every Tuesday at 7 AM UTC - cron: '0 7 * * 2' + pull_request: + branches: + - main jobs: build: @@ -29,12 +32,20 @@ jobs: steps: - name: Get current date id: date - run: echo "::set-output name=current_date::$(date +'%Y-%m-%d')" + run: echo "::set-output name=current_date::$(date +'%Y-%m-%d-%HH%MM%SS')" + + - name: Sync fork + run: gh repo sync $REPOSITORY -b $BRANCH_NAME + env: + GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} - name: Check out main branch uses: actions/checkout@v3 with: ref: refs/heads/main + repository: 'yoshi-code-bot/google-api-python-client' + token: ${{secrets.YOSHI_CODE_BOT_TOKEN}} + - name: Create branch run: | @@ -68,7 +79,7 @@ jobs: working-directory: ./scripts - name: Push changes - run: git push -f --set-upstream origin update-discovery-artifacts-${{ steps.date.outputs.current_date }} + run: git push update-discovery-artifacts-${{ steps.date.outputs.current_date }} - name: Prepare summary for PR Body id: pr_body From bcffc574054857cdfed10f7df269fa7d44acd249 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 20 Jun 2023 14:36:47 +0000 Subject: [PATCH 2/9] testing --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf18450e210..0e48352b4a0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,6 +37,8 @@ jobs: - name: Sync fork run: gh repo sync $REPOSITORY -b $BRANCH_NAME env: + REPOSITORY: 'yoshi-code-bot/google-api-python-client' + BRANCH_NAME: 'refs/heads/main' GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} - name: Check out main branch @@ -46,7 +48,6 @@ jobs: repository: 'yoshi-code-bot/google-api-python-client' token: ${{secrets.YOSHI_CODE_BOT_TOKEN}} - - name: Create branch run: | git checkout -b update-discovery-artifacts-${{ steps.date.outputs.current_date }} From 1c486fab115e5285264e293454d56be0dd9a7bbf Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 20 Jun 2023 14:42:34 +0000 Subject: [PATCH 3/9] testing --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e48352b4a0..f321e05e243 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -80,7 +80,7 @@ jobs: working-directory: ./scripts - name: Push changes - run: git push update-discovery-artifacts-${{ steps.date.outputs.current_date }} + run: git push -u origin update-discovery-artifacts-${{ steps.date.outputs.current_date }} - name: Prepare summary for PR Body id: pr_body From 4b1fc65c202d954657464182e72250d4ce265029 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 20 Jun 2023 14:50:50 +0000 Subject: [PATCH 4/9] testing --- .github/workflows/main.yml | 44 ++++---------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f321e05e243..c4e036c8a8e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -95,43 +95,7 @@ jobs: working-directory: ./scripts - name: Create PR - uses: actions/github-script@v6.4.1 - with: - github-token: ${{secrets.YOSHI_CODE_BOT_TOKEN}} - script: | - async function createPR () { - const { owner, repo } = context.repo - const branch = 'update-discovery-artifacts-${{ steps.date.outputs.current_date }}' - let prBody = `${{ steps.pr_body.outputs.change_summary }}` - const prTitle = 'chore: Update discovery artifacts' - const pullRequests = await github.rest.pulls.list({ - owner: owner, - repo: repo, - head: `${owner}:${branch}`, - state: 'open' - }) - - if (pullRequests.data.length === 1) { - prNumber = pullRequests.data[0].number - await github.rest.pulls.update({ - owner: owner, - repo: repo, - pull_number: prNumber, - title: prTitle, - body: prBody - }) - console.log('Updated PR') - } else { - const createPrResult = await github.rest.pulls.create({ - owner: owner, - repo: repo, - base: 'main', - head: `${owner}:${branch}`, - title: prTitle, - body: prBody - }) - prNumber = createPrResult.data.number - console.log('Created PR') - } - } - createPR() + env: + GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} + PR_TITLE: 'chore: Update discovery artifacts' + run: gh pr create -B 'main' --title '$PR_TITLE' --body '${{ steps.pr_body.outputs.change_summary }}' From a136f34797f6b6055123de595b1ae0cb9a10a159 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 20 Jun 2023 15:06:09 +0000 Subject: [PATCH 5/9] testing --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c4e036c8a8e..4b79b5f7245 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -98,4 +98,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} PR_TITLE: 'chore: Update discovery artifacts' - run: gh pr create -B 'main' --title '$PR_TITLE' --body '${{ steps.pr_body.outputs.change_summary }}' + run: gh pr create -R 'googleapis/google-api-python-client' -B 'main' --title '${PR_TITLE}' --body '${{ steps.pr_body.outputs.change_summary }}' From 9e6cc40d8de58cf39f857bd539dc154bfd0ac024 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 20 Jun 2023 15:15:14 +0000 Subject: [PATCH 6/9] testing --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4b79b5f7245..0bb198f336a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -98,4 +98,5 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} PR_TITLE: 'chore: Update discovery artifacts' - run: gh pr create -R 'googleapis/google-api-python-client' -B 'main' --title '${PR_TITLE}' --body '${{ steps.pr_body.outputs.change_summary }}' + run: | + gh pr create -R 'googleapis/google-api-python-client' -B 'main' --title $PR_TITLE --body '${{ steps.pr_body.outputs.change_summary }}' From dc4fce5dc682e853d53f224b768e1a99b10cb5e4 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 20 Jun 2023 15:20:06 +0000 Subject: [PATCH 7/9] testing --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0bb198f336a..fb7735d0622 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -99,4 +99,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} PR_TITLE: 'chore: Update discovery artifacts' run: | - gh pr create -R 'googleapis/google-api-python-client' -B 'main' --title $PR_TITLE --body '${{ steps.pr_body.outputs.change_summary }}' + gh pr create -R 'googleapis/google-api-python-client' -B 'main' --title '${{ PR_TITLE }}' --body '${{ steps.pr_body.outputs.change_summary }}' From 19b9632f9ef2f8827eade0ca39c3771d4cc8a988 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 20 Jun 2023 15:26:22 +0000 Subject: [PATCH 8/9] testing --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb7735d0622..071f152deef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -97,6 +97,6 @@ jobs: - name: Create PR env: GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} - PR_TITLE: 'chore: Update discovery artifacts' + PR_TITLE: "chore: Update discovery artifacts" run: | - gh pr create -R 'googleapis/google-api-python-client' -B 'main' --title '${{ PR_TITLE }}' --body '${{ steps.pr_body.outputs.change_summary }}' + gh pr create -R "googleapis/google-api-python-client" -B "main" --title "$PR_TITLE" --body "${{ steps.pr_body.outputs.change_summary }}" From 8d652c3477ba7435076ec837831404a62fc0926d Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 8 Jan 2024 13:44:31 -0500 Subject: [PATCH 9/9] trigger on cron job --- .github/workflows/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 54f05326097..fcd78bd67ed 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,9 +20,6 @@ on: # * is a special character in YAML so you have to quote this string # Run this Github Action every Tuesday at 7 AM UTC - cron: '0 7 * * 2' - pull_request: - branches: - - main jobs: build: