From 84c152173a85004dac43be905097aacc59685a0f Mon Sep 17 00:00:00 2001 From: Topher Lubaway Date: Wed, 28 Sep 2022 09:01:36 -0500 Subject: [PATCH 1/3] Cleans up label actions Also fixes my very silly implementation --- ...yml => label-github-issues-by-context.yml} | 10 +++--- ...er.yml => label-github-issues-by-path.yml} | 2 +- .github/workflows/label-prs-by-context.yml | 34 +++++++++++++++++++ .github/workflows/notify-on-label.yml | 20 +++++++++-- .../workflows/notify-on-push-to-master.yml | 20 +++++++++-- .github/workflows/shared-pulls.yml | 18 ---------- 6 files changed, 75 insertions(+), 29 deletions(-) rename .github/workflows/{label-github-issues.yml => label-github-issues-by-context.yml} (76%) rename .github/workflows/{labeler.yml => label-github-issues-by-path.yml} (83%) 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.yml b/.github/workflows/label-github-issues-by-context.yml similarity index 76% rename from .github/workflows/label-github-issues.yml rename to .github/workflows/label-github-issues-by-context.yml index f23361864fe6..184f5762450b 100644 --- a/.github/workflows/label-github-issues.yml +++ b/.github/workflows/label-github-issues-by-context.yml @@ -11,16 +11,14 @@ jobs: 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 }} + ${{ secrets.OCTAVIA_4_ROOT_ACCESS }} \ + ${{ secrets.OCTAVIA_PAT }} shared-issues: name: "Add Labels to Issues. Safe to Merge on fail" runs-on: ubuntu-latest @@ -31,7 +29,7 @@ jobs: 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 }}" + # 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 e1761c4c1771..d59067a093ea 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-prs-by-context.yml b/.github/workflows/label-prs-by-context.yml new file mode 100644 index 000000000000..707c8688de04 --- /dev/null +++ b/.github/workflows/label-prs-by-context.yml @@ -0,0 +1,34 @@ +# 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: + 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: Checkout Airbyte + uses: actions/checkout@v2 + - name: Check PAT rate limits + id: variables + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.OCTAVIA_4_ROOT_ACCESS }} \ + ${{ secrets.OCTAVIA_PAT }} + shared-pr-labeller: + name: "Add Labels to PRs. Safe to Merge on fail" + 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: "${{ env.PAT }}" + command: "pull" diff --git a/.github/workflows/notify-on-label.yml b/.github/workflows/notify-on-label.yml index 6d47413f7e55..5a26e7f4b2e4 100644 --- a/.github/workflows/notify-on-label.yml +++ b/.github/workflows/notify-on-label.yml @@ -1,18 +1,34 @@ # 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: types: [labeled] 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: Checkout Airbyte + uses: actions/checkout@v2 + - name: Check PAT rate limits + id: variables + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.OCTAVIA_4_ROOT_ACCESS }} \ + ${{ secrets.OCTAVIA_PAT }} 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 }} + token: "${{ env.PAT }}" message: 'cc {recipients}' # Specify a map of label -> team/user to notify recipients: | diff --git a/.github/workflows/notify-on-push-to-master.yml b/.github/workflows/notify-on-push-to-master.yml index 48f3a8f35271..6dcbfdefb92c 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: @@ -6,13 +6,29 @@ on: workflow_dispatch: 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: Checkout Airbyte + uses: actions/checkout@v2 + - name: Check PAT rate limits + id: variables + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.OCTAVIA_4_ROOT_ACCESS }} \ + ${{ secrets.OCTAVIA_PAT }} repo-sync: + name: "Fire a Repo Dispatch event to airbyte-cloud" runs-on: ubuntu-latest steps: - 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 23c065ed7b3b..000000000000 --- 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" From e6eca4180f8865e2cb09794957a28df1313ddb79 Mon Sep 17 00:00:00 2001 From: Topher Lubaway Date: Wed, 28 Sep 2022 09:20:33 -0500 Subject: [PATCH 2/3] removes unsused output --- .github/workflows/label-github-issues-by-context.yml | 2 -- .github/workflows/label-prs-by-context.yml | 2 -- .github/workflows/notify-on-label.yml | 2 -- 3 files changed, 6 deletions(-) diff --git a/.github/workflows/label-github-issues-by-context.yml b/.github/workflows/label-github-issues-by-context.yml index 184f5762450b..82a0800b683a 100644 --- a/.github/workflows/label-github-issues-by-context.yml +++ b/.github/workflows/label-github-issues-by-context.yml @@ -8,8 +8,6 @@ jobs: name: "Find a PAT with room for actions" timeout-minutes: 10 runs-on: ubuntu-latest - outputs: - pat: ${{ steps.variables.outputs.pat }} steps: - name: Checkout Airbyte uses: actions/checkout@v2 diff --git a/.github/workflows/label-prs-by-context.yml b/.github/workflows/label-prs-by-context.yml index 707c8688de04..0b820e8e81e2 100644 --- a/.github/workflows/label-prs-by-context.yml +++ b/.github/workflows/label-prs-by-context.yml @@ -10,8 +10,6 @@ jobs: name: "Find a PAT with room for actions" timeout-minutes: 10 runs-on: ubuntu-latest - outputs: - pat: ${{ steps.variables.outputs.pat }} steps: - name: Checkout Airbyte uses: actions/checkout@v2 diff --git a/.github/workflows/notify-on-label.yml b/.github/workflows/notify-on-label.yml index 5a26e7f4b2e4..cc7fb126fe4c 100644 --- a/.github/workflows/notify-on-label.yml +++ b/.github/workflows/notify-on-label.yml @@ -11,8 +11,6 @@ jobs: name: "Find a PAT with room for actions" timeout-minutes: 10 runs-on: ubuntu-latest - outputs: - pat: ${{ steps.variables.outputs.pat }} steps: - name: Checkout Airbyte uses: actions/checkout@v2 From 81fefa8db14b3e62ec186a2e71b2bd79e336dfca Mon Sep 17 00:00:00 2001 From: Topher Lubaway Date: Wed, 28 Sep 2022 09:26:26 -0500 Subject: [PATCH 3/3] Keep titles the same across jerbs --- .github/workflows/label-prs-by-context.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label-prs-by-context.yml b/.github/workflows/label-prs-by-context.yml index 0b820e8e81e2..fddd5e28f288 100644 --- a/.github/workflows/label-prs-by-context.yml +++ b/.github/workflows/label-prs-by-context.yml @@ -1,6 +1,6 @@ # Runs internal automation for pull requests -name: "Add metadata and labels to PRs based on context" +name: "Add labels to github PRs based on context" on: pull_request_target: types: [opened, labeled, unlabeled, ready_for_review, synchronize, reopened]