From 6eef3ef60e25cfb99290b7a68bd9fdd0d452427e Mon Sep 17 00:00:00 2001 From: Topher Lubaway Date: Wed, 28 Sep 2022 11:18:37 -0500 Subject: [PATCH] Toph cleans up labellers ii (#17330) * Further testing This reverts commit 83cdf198f12f47496494b0de23cc836aa57365a5. * Moves find_valid_pat into single job * Removes duplicate find_valid_pat * Moves find_valid_pat to single job * New name for FE notifier --- .../label-github-issues-by-context.yml | 27 ++++++++++++++ ...er.yml => label-github-issues-by-path.yml} | 2 +- .github/workflows/label-github-issues.yml | 37 ------------------- .github/workflows/label-prs-by-context.yml | 28 ++++++++++++++ .github/workflows/notify-on-label.yml | 27 ++++++++++---- .../workflows/notify-on-push-to-master.yml | 13 ++++++- .github/workflows/shared-pulls.yml | 18 --------- 7 files changed, 86 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/label-github-issues-by-context.yml rename .github/workflows/{labeler.yml => label-github-issues-by-path.yml} (83%) delete mode 100644 .github/workflows/label-github-issues.yml create mode 100644 .github/workflows/label-prs-by-context.yml delete mode 100644 .github/workflows/shared-pulls.yml diff --git a/.github/workflows/label-github-issues-by-context.yml b/.github/workflows/label-github-issues-by-context.yml new file mode 100644 index 0000000000000..48cc8f26d20d4 --- /dev/null +++ b/.github/workflows/label-github-issues-by-context.yml @@ -0,0 +1,27 @@ +name: "Add labels to github issues based on context" +on: + issues: + types: [opened, labeled, unlabeled] + +jobs: + shared-issues: + name: "Add Labels to Issues. Safe to Merge on fail" + runs-on: ubuntu-latest + steps: + - name: Checkout Airbyte Repo for PAT command + uses: actions/checkout@v2 + - name: Check PAT rate limits + # Cannot share PAT outside of JOB context + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.OCTAVIA_4_ROOT_ACCESS }} \ + ${{ secrets.OCTAVIA_PAT }} + - name: Run Issue Command from workflow-actions + uses: nick-fields/private-action-loader@v3 + with: + pal-repo-token: "${{ env.PAT }}" + pal-repo-name: airbytehq/workflow-actions@production + # the following input gets passed to the private + token: "${{ env.PAT }}" + # ref: https://github.com/airbytehq/workflow-actions/blob/main/src/bin_issue.ts + command: "issue" diff --git a/.github/workflows/labeler.yml b/.github/workflows/label-github-issues-by-path.yml similarity index 83% rename from .github/workflows/labeler.yml rename to .github/workflows/label-github-issues-by-path.yml index e1761c4c1771d..d59067a093ea7 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/label-github-issues-by-path.yml @@ -1,5 +1,5 @@ # the mapping from filepath to label -# is defined in .github/labeler.yml +# is defined in .github/label-github-issues-by-path.yml name: "Label PR based on filepath" on: diff --git a/.github/workflows/label-github-issues.yml b/.github/workflows/label-github-issues.yml deleted file mode 100644 index f23361864fe65..0000000000000 --- a/.github/workflows/label-github-issues.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: "Add labels to github issues based on context" -on: - issues: - types: [opened, labeled, unlabeled] - -jobs: - find_valid_pat: - name: "Find a PAT with room for actions" - timeout-minutes: 10 - runs-on: ubuntu-latest - outputs: - pat: ${{ steps.variables.outputs.pat }} - steps: - - name: UUID ${{ github.event.inputs.uuid }} - run: true - - name: Checkout Airbyte - uses: actions/checkout@v2 - - name: Check PAT rate limits - id: variables - run: | - ./tools/bin/find_non_rate_limited_PAT \ - ${{ secrets.OCTAVIA_PAT }} \ - ${{ secrets.OCTAVIA_4_ROOT_ACCESS }} - shared-issues: - name: "Add Labels to Issues. Safe to Merge on fail" - runs-on: ubuntu-latest - needs: - - find_valid_pat - steps: - - uses: nick-fields/private-action-loader@v3 - with: - pal-repo-token: "${{ needs.find_valid_pat.outputs.pat }}" - pal-repo-name: airbytehq/workflow-actions@production - # the following input gets passed to the private action - token: "${{ needs.find_valid_pat.outputs.pat }}" - # ref: https://github.com/airbytehq/workflow-actions/blob/main/src/bin_issue.ts - command: "issue" diff --git a/.github/workflows/label-prs-by-context.yml b/.github/workflows/label-prs-by-context.yml new file mode 100644 index 0000000000000..b733096e87c4e --- /dev/null +++ b/.github/workflows/label-prs-by-context.yml @@ -0,0 +1,28 @@ +# Runs internal automation for pull requests + +name: "Add labels to github PRs based on context" +on: + pull_request_target: + types: [opened, labeled, unlabeled, ready_for_review, synchronize, reopened] + +jobs: + shared-pr-labeller: + name: "Add Labels to PRs. Safe to Merge on fail" + runs-on: ubuntu-latest + steps: + - name: Checkout Airbyte Repo for PAT command + uses: actions/checkout@v2 + - name: Check PAT rate limits + # Cannot share PAT outside of JOB context + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.OCTAVIA_4_ROOT_ACCESS }} \ + ${{ secrets.OCTAVIA_PAT }} + - name: Run Issue Command from workflow-actions + uses: nick-fields/private-action-loader@v3 + with: + pal-repo-token: "${{ env.PAT }}" + pal-repo-name: airbytehq/workflow-actions@production + # the following input gets passed to the private action + token: "${{ env.PAT }}" + command: "pull" diff --git a/.github/workflows/notify-on-label.yml b/.github/workflows/notify-on-label.yml index 6d47413f7e55c..dbbb7a4b54ef8 100644 --- a/.github/workflows/notify-on-label.yml +++ b/.github/workflows/notify-on-label.yml @@ -1,6 +1,6 @@ # Notify users/teams when labels are added to an issue. -name: Notify when adding label to issue +name: Notify FE team for FE label on issues on: issues: @@ -8,12 +8,23 @@ on: jobs: notify: + name: "Notify FE team on label creation" runs-on: ubuntu-latest steps: - - uses: jenschelkopf/issue-label-notification-action@1.3 - with: - token: ${{ secrets.OCTAVIA_PAT }} - message: 'cc {recipients}' - # Specify a map of label -> team/user to notify - recipients: | - team/frontend=@airbytehq/frontend + - name: Checkout Airbyte Repo for PAT command + uses: actions/checkout@v2 + - name: Check PAT rate limits + # Cannot share PAT outside of JOB context + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.OCTAVIA_4_ROOT_ACCESS }} \ + ${{ secrets.OCTAVIA_PAT }} + # Updated name to reflect reality. Update name if you change recipients + - name: Notify FE team when on FE label creation + uses: jenschelkopf/issue-label-notification-action@1.3 + with: + token: "${{ env.PAT }}" + message: 'cc {recipients}' + # Specify a map of label -> team/user to notify + recipients: | + team/frontend=@airbytehq/frontend diff --git a/.github/workflows/notify-on-push-to-master.yml b/.github/workflows/notify-on-push-to-master.yml index 48f3a8f352711..33d5a94f8f913 100644 --- a/.github/workflows/notify-on-push-to-master.yml +++ b/.github/workflows/notify-on-push-to-master.yml @@ -1,4 +1,4 @@ -name: Notify Cloud of OSS Push to Master +name: Trigger action in cloud based on push on: push: branches: @@ -7,12 +7,21 @@ on: jobs: repo-sync: + name: "Fire a Repo Dispatch event to airbyte-cloud" runs-on: ubuntu-latest steps: + - name: Checkout Airbyte Repo for PAT command + uses: actions/checkout@v2 + - name: Check PAT rate limits + # Cannot share PAT outside of JOB context + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.OCTAVIA_4_ROOT_ACCESS }} \ + ${{ secrets.OCTAVIA_PAT }} - name: Repository Dispatch uses: peter-evans/repository-dispatch@v2 with: - token: ${{ secrets.OCTAVIA_PAT }} + token: ${{ env.pat }} repository: airbytehq/airbyte-cloud event-type: oss-push-to-master client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' diff --git a/.github/workflows/shared-pulls.yml b/.github/workflows/shared-pulls.yml deleted file mode 100644 index 23c065ed7b3bd..0000000000000 --- a/.github/workflows/shared-pulls.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Runs internal automation for pull requests - -name: "Add metadata and labels to PRs based on context" -on: - pull_request_target: - types: [opened, labeled, unlabeled, ready_for_review, synchronize, reopened] - -jobs: - shared-pulls: - runs-on: ubuntu-latest - steps: - - uses: nick-fields/private-action-loader@v3 - with: - pal-repo-token: "${{ secrets.OCTAVIA_PAT }}" - pal-repo-name: airbytehq/workflow-actions@production - # the following input gets passed to the private action - token: "${{ secrets.OCTAVIA_PAT }}" - command: "pull"