From 3729aca71ef0010c2d6fa92ac468ed2f5b6372b9 Mon Sep 17 00:00:00 2001 From: Rachael Sewell Date: Wed, 14 Oct 2020 14:06:16 -0700 Subject: [PATCH 1/4] add workflow to triage PRs opened by Hubber external contributors (#16018) Co-authored-by: Zeke Sikelianos --- .../first-responder-docs-content.yml | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/first-responder-docs-content.yml diff --git a/.github/workflows/first-responder-docs-content.yml b/.github/workflows/first-responder-docs-content.yml new file mode 100644 index 000000000000..ac1d0d7db66e --- /dev/null +++ b/.github/workflows/first-responder-docs-content.yml @@ -0,0 +1,79 @@ +name: First responder docs-content +on: + pull_request: + types: [reopened, opened, ready_for_review, unlabeled] + +jobs: + first-responder-triage: + if: github.repository == 'github/docs-internal' && github.event.pull_request.draft == false && github.event.action != 'unlabeled' + runs-on: ubuntu-latest + + steps: + - name: Check if the event originated from a team member + uses: actions/github-script@v2.0.0 + id: set-result + with: + github-token: ${{secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES}} + result-encoding: string + script: | + const repoName = context.payload.repository.name + const ownerName = context.payload.repository.owner.login + const issueNumber = (context.eventName === "issues") ? context.payload.issue.number : context.payload.number + const updatedIssueInformation = await github.issues.get({ + owner: ownerName, + repo: repoName, + issue_number: issueNumber + }) + const teamMembers = await github.request( + `/orgs/github/teams/docs/members` + ) + const logins = teamMembers.data.map(member => member.login) + if (logins.some(login => login === updatedIssueInformation.data.user.login)) { + console.log(`This issue or pull request was authored by a member of the github/docs team.`) + return 'true' + } + console.log(`This issue or pull request was authored by an external contributor.`) + return 'false' + - name: Label external contributor pull requests with docs-content-fr + uses: rachmari/labeler@v1.0.4 + if: steps.set-result.outputs.result == 'false' + with: + repo-token: "${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}" + add-labels: "docs-content-fr" + - name: Triage to FR PR project column + uses: rachmari/actions-add-new-issue-to-column@v1.1.1 + if: steps.set-result.outputs.result == 'false' + with: + action-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }} + project-url: "https://github.com/orgs/github/projects/1367" + column-name: "Docs-internal external contributor PRs" + + first-responder-label-removed: + if: github.event.label.name == 'docs-content-fr' && github.event.action == 'unlabeled' + runs-on: ubuntu-latest + + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Remove card from project + uses: actions/github-script@v2.0.0 + with: + github-token: ${{secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES}} + result-encoding: string + script: | + const issueToRemove = context.payload.number + const cards = await github.projects.listCards({ + column_id: 11130889 + }) + cards.data.forEach(card => { + if (card.content_url) { + const cardIssueNumber = parseInt(card.content_url.split('/').pop(), 10) + if (cardIssueNumber === issueToRemove) { + const cards = github.projects.deleteCard({ + card_id: card.id + }) + } + } + }) From 853564b88768eea8de4b31e0a36a1369b74f04f9 Mon Sep 17 00:00:00 2001 From: Sarah Edwards Date: Wed, 14 Oct 2020 16:21:32 -0700 Subject: [PATCH 2/4] Issue #2786--Instruct to use tag instead of label (#15917) Co-authored-by: Rachael Sewell --- .../creating-a-composite-run-steps-action.md | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/content/actions/creating-actions/creating-a-composite-run-steps-action.md b/content/actions/creating-actions/creating-a-composite-run-steps-action.md index 14a4de8453f2..34312304fd0c 100644 --- a/content/actions/creating-actions/creating-a-composite-run-steps-action.md +++ b/content/actions/creating-actions/creating-a-composite-run-steps-action.md @@ -36,7 +36,7 @@ Before you begin, you'll create a {% data variables.product.product_name %} repo echo "Goodbye" ``` -1. From your terminal, make `goodbye.sh` executable and check it into your repository. +3. From your terminal, make `goodbye.sh` executable. ```shell chmod +x goodbye.sh @@ -85,14 +85,26 @@ Before you begin, you'll create a {% data variables.product.product_name %} repo For more information about how to use `github.action_path`, see "[`github context`](/actions/reference/context-and-expression-syntax-for-github-actions#github-context)". -1. Create a new label. This example uses a label called `v1` for the main branch. For more information, see "[Creating a label -](/github/managing-your-work-on-github/creating-a-label)." +1. From your terminal, check in your `action.yml` file. + + ```shell + git add action.yml + git commit -m "Add action" + git push + ``` + +1. From your terminal, add a tag. This example uses a tag called `v1`. For more information, see "[About actions](/actions/creating-actions/about-actions#using-release-management-for-actions)." + + ```shell + git tag -a -m "Description of this release" v1 + git push --follow-tags + ``` ### Testing out your action in a workflow The following workflow code uses the completed hello world action that you made in "[Creating an action metadata file](/actions/creating-actions/creating-a-composite-run-steps-action#creating-an-action-metadata-file)". -Copy the workflow code into a `.github/workflows/main.yml` file in another repository, but replace `actions/hello-world-composite-run-steps-action@v1` with the repository and label you created. You can also replace the `who-to-greet` input with your name. +Copy the workflow code into a `.github/workflows/main.yml` file in another repository, but replace `actions/hello-world-composite-run-steps-action@v1` with the repository and tag you created. You can also replace the `who-to-greet` input with your name. {% raw %} **.github/workflows/main.yml** From 33a0898167c84c59e8579bafcabd7593d619f3ea Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Wed, 14 Oct 2020 22:56:26 -0700 Subject: [PATCH 3/4] use @octoglot PAT in Crowdin workflow (#16045) --- .github/workflows/crowdin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index 89b4f42689e6..0c4cfe2b1307 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -38,7 +38,7 @@ jobs: crowdin_branch_name: crowdin-main env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OCTOGLOT_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} # This is a numeric id, not to be confused with Crowdin API v1 "project identifier" string # See "API v2" on https://crowdin.com/project//settings#api From e33eb21fe6000af915213722c2af1e0e9ce9768d Mon Sep 17 00:00:00 2001 From: Lucas Costi Date: Thu, 15 Oct 2020 16:17:06 +1000 Subject: [PATCH 4/4] Update OpenAPI script bundle command (#16044) --- script/preview-openapi-changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/preview-openapi-changes b/script/preview-openapi-changes index 7f845f054b8c..dc8109915e14 100755 --- a/script/preview-openapi-changes +++ b/script/preview-openapi-changes @@ -48,7 +48,7 @@ if [[ $OPTION == "stitch" ]]; then # Generate the deferenced OpenAPI files from github/github cd github - bin/dump-openapi-description /tmp/dump + bin/openapi bundle /tmp/dump # Copy the derefrenced json files into rest-api-operations and build them cd ../rest-api-operations