From 9b3983c1bf7a0814140447be7075c512e34eef9d Mon Sep 17 00:00:00 2001 From: Ashish Padhy <100484401+Shurtu-gal@users.noreply.github.com> Date: Thu, 29 Feb 2024 01:06:14 +0530 Subject: [PATCH] chore: single autoupdate workflow to do everything --- .github/workflows/autoupdate-pr-branches.yml | 46 ------------------ .github/workflows/autoupdate.yml | 51 ++++++++++++-------- 2 files changed, 32 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/autoupdate-pr-branches.yml diff --git a/.github/workflows/autoupdate-pr-branches.yml b/.github/workflows/autoupdate-pr-branches.yml deleted file mode 100644 index 3314245a..00000000 --- a/.github/workflows/autoupdate-pr-branches.yml +++ /dev/null @@ -1,46 +0,0 @@ -# This workflow is centrally managed in https://github.com/asyncapi/.github/ -# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo - -# This workflow will run on every push to the repository or comment with /update or /u. And will create merge-commits for all PRs to respective branches. -# This also works with forks, not only with branches in the same repository/organization. -# Currently, does not work with forks in different organizations. - -# This workflow will be distributed to all repositories in the AsyncAPI organization. - -name: Autoupdate PR branches - -on: - push: - branches-ignore: - - 'version-bump/**' - - 'dependabot/**' - - 'bot/**' - - 'all-contributors/**' - - issue_comment: - types: [created] - -jobs: - autoupdate-fork: - if: > - startsWith(github.repository, 'asyncapi/') && - ( - github.event_name == 'push' || - ( - github.event_name == 'issue_comment' && - github.event.issue.pull_request != null && - ( - contains(github.event.comment.body, '/update') || - contains(github.event.comment.body, '/u') - ) - ) - ) - runs-on: ubuntu-latest - steps: - - name: Autoupdate PR branches - uses: Shurtu-gal/autoupdate-fork-action@401ab8a7cea6c1288599f7cd030093a58c6765ee - with: - github_token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} - pr_filter: 'all' - merge_fail_action: 'comment' - ignore_conflicts: true diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml index bcc0f01e..9339423c 100644 --- a/.github/workflows/autoupdate.yml +++ b/.github/workflows/autoupdate.yml @@ -1,14 +1,13 @@ -# This action is centrally managed in https://github.com/asyncapi/.github/ +# This workflow is centrally managed in https://github.com/asyncapi/.github/ # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo -# This workflow is designed to work with: -# - autoapprove and automerge workflows for dependabot and asyncapibot. -# - special release branches that we from time to time create in upstream repos. If we open up PRs for them from the very beginning of the release, the release branch will constantly update with new things from the destination branch they are opened against +# This workflow will run on every push to the repository or comment with /update or /u. And will create merge-commits for all PRs to respective branches. +# This also works with forks, not only with branches in the same repository/organization. +# Currently, does not work with forks in different organizations. -# It uses GitHub Action that auto-updates pull requests branches, whenever changes are pushed to their destination branch. -# Autoupdating to latest destination branch works only in the context of upstream repo and not forks +# This workflow will be distributed to all repositories in the AsyncAPI organization. -name: autoupdate +name: Autoupdate PR branches on: push: @@ -18,18 +17,32 @@ on: - 'bot/**' - 'all-contributors/**' + issue_comment: + types: [created] + jobs: - autoupdate-for-bot: - if: startsWith(github.repository, 'asyncapi/') - name: Autoupdate autoapproved PR created in the upstream + autoupdate-fork: + if: > + startsWith(github.repository, 'asyncapi/') && + ( + github.event_name == 'push' || + ( + github.event_name == 'issue_comment' && + github.event.issue.pull_request != null && + ( + contains(github.event.comment.body, '/update') || + contains(github.event.comment.body, '/u') + ) + ) + ) runs-on: ubuntu-latest steps: - - name: Autoupdating - uses: docker://chinthakagodawita/autoupdate-action:v1 - env: - GITHUB_TOKEN: '${{ secrets.GH_TOKEN_BOT_EVE }}' - PR_FILTER: "labelled" - PR_LABELS: "autoupdate" - PR_READY_STATE: "ready_for_review" - MERGE_CONFLICT_ACTION: "ignore" - \ No newline at end of file + - name: Autoupdate PR branches + uses: Shurtu-gal/autoupdate-fork-action@a5019320a0462993ded9bbe6c04fb1c6684d67c7 + with: + github_token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} + # The label to see on push event. By default, on issue_comment event there will be no PR_FILTER + pr_filter: 'labelled' + pr_label: 'autoupdate' + merge_fail_action: 'comment' + ignore_conflicts: true