Skip to content

Commit 630a659

Browse files
authored
Merge branch 'main' into graphql-schema-update
2 parents dac06bd + 18dcf9b commit 630a659

91 files changed

Lines changed: 410 additions & 271 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions-scripts/fr-add-docs-reviewers-requests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async function run() {
8484
!pr.isDraft &&
8585
!pr.labels.nodes.find((label) => label.name === 'Deploy train 🚂') &&
8686
pr.reviewRequests.nodes.find(
87-
(requestedReviewers) => requestedReviewers.requestedReviewer.name === process.env.REVIEWER
87+
(requestedReviewers) => requestedReviewers.requestedReviewer?.name === process.env.REVIEWER
8888
) &&
8989
!pr.reviews.nodes
9090
.flatMap((review) => review.onBehalfOf.nodes)

.github/actions-scripts/projects.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,29 @@ export async function isDocsTeamMember(login) {
114114
return teamMembers.includes(login)
115115
}
116116

117+
// Given a GitHub login, returns a bool indicating
118+
// whether the login is part of the GitHub org
119+
export async function isGitHubOrgMember(login) {
120+
const data = await graphql(
121+
`
122+
query {
123+
user(login: "${login}") {
124+
organization(login: "github"){
125+
name
126+
}
127+
}
128+
}
129+
`,
130+
{
131+
headers: {
132+
authorization: `token ${process.env.TOKEN}`,
133+
},
134+
}
135+
)
136+
137+
return Boolean(data.user.organization)
138+
}
139+
117140
// Formats a date object into the required format for projects
118141
export function formatDateForProject(date) {
119142
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
@@ -246,6 +269,7 @@ export default {
246269
addItemsToProject,
247270
addItemToProject,
248271
isDocsTeamMember,
272+
isGitHubOrgMember,
249273
findFieldID,
250274
findSingleSelectID,
251275
formatDateForProject,

.github/actions-scripts/ready-for-docs-review.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { graphql } from '@octokit/graphql'
33
import {
44
addItemToProject,
55
isDocsTeamMember,
6+
isGitHubOrgMember,
67
findFieldID,
78
findSingleSelectID,
89
generateUpdateProjectNextItemFieldMutation,
@@ -178,9 +179,12 @@ async function run() {
178179
let contributorType
179180
if (await isDocsTeamMember(process.env.AUTHOR_LOGIN)) {
180181
contributorType = docsMemberTypeID
182+
} else if (await isGitHubOrgMember(process.env.AUTHOR_LOGIN)) {
183+
contributorType = hubberTypeID
181184
} else if (process.env.REPO === 'github/docs') {
182185
contributorType = osContributorTypeID
183186
} else {
187+
// use hubber as the fallback so that the PR doesn't get lost on the board
184188
contributorType = hubberTypeID
185189
}
186190

.github/allowed-actions.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
runs-on: ubuntu-latest
3232
steps:
3333
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
34-
- uses: github/codeql-action/init@v1
34+
- uses: github/codeql-action/init@5f532563584d71fdef14ee64d17bafb34f751ce5
3535
with:
3636
languages: javascript # comma separated list of values from {go, python, javascript, java, cpp, csharp} (not YET ruby, sorry!)
37-
- uses: github/codeql-action/analyze@v1
37+
- uses: github/codeql-action/analyze@5f532563584d71fdef14ee64d17bafb34f751ce5
3838
continue-on-error: true

.github/workflows/repo-sync.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ jobs:
113113
uses: repo-sync/github-sync@3832fe8e2be32372e1b3970bbae8e7079edeec88
114114
env:
115115
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
116-
CI: true
117116
with:
118117
source_repo: ${{ secrets.SOURCE_REPO }} # https://${access_token}@github.com/github/the-other-repo.git
119118
source_branch: main

.github/workflows/staging-build-and-deploy-pr.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ name: Staging - Build and Deploy PR (fast and private-only)
66

77
# This whole workflow is only guaranteed to be secure in the *private
88
# repo* and because we repo-sync these files over the to the public one,
9-
# IT'S CRUCIALLY IMPORTANT THAT THIS WORKFLOW IS ONLY ENABLED IN docs-internal!
9+
# IT'S IMPORTANT THAT THIS WORKFLOW IS ONLY ENABLED IN docs-internal!
1010

1111
on:
12-
# Ideally, we'd like to use 'pull_request' because we can more easily
13-
# test changes to this workflow without relying on merges to 'main'.
14-
# But this is guaranteed to be safer and won't have the problem of
15-
# necessary secrets not being available.
16-
# Perhaps some day when we're confident this workflow will always
17-
# work in a regular PR, we can switch to that.
18-
pull_request_target:
12+
# The advantage of 'pull_request' over 'pull_request_target' is that we
13+
# can make changes to this file and test them in a pull request, instead
14+
# of relying on landing it in 'main' first.
15+
# From a security point of view, its arguably safer this way because
16+
# unlike 'pull_request_target', these only have secrets if the pull
17+
# request creator has permission to access secrets.
18+
pull_request:
1919

2020
permissions:
2121
actions: read

.github/workflows/test-windows.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ concurrency:
2020
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
2121
cancel-in-progress: true
2222

23-
env:
24-
CI: true
25-
2623
jobs:
2724
test:
2825
runs-on: windows-latest

.github/workflows/test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ concurrency:
2020
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
2121
cancel-in-progress: true
2222

23-
env:
24-
CI: true
25-
2623
jobs:
2724
test:
2825
# Run on self-hosted if the private repo or ubuntu-latest if the public repo

content/actions/creating-actions/metadata-syntax-for-github-actions.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ runs:
175175

176176
### `pre-if`
177177

178-
**Optional** Allows you to define conditions for the `pre:` action execution. The `pre:` action will only run if the conditions in `pre-if` are met. If not set, then `pre-if` defaults to `always()`.
178+
**Optional** Allows you to define conditions for the `pre:` action execution. The `pre:` action will only run if the conditions in `pre-if` are met. If not set, then `pre-if` defaults to `always()`. In `pre-if`, status check functions evaluate against the job's status, not the action's own status.
179+
179180
Note that the `step` context is unavailable, as no steps have run yet.
180181

181182
In this example, `cleanup.js` only runs on Linux-based runners:
@@ -202,7 +203,7 @@ The `post:` action always runs by default but you can override this using `post-
202203

203204
### `post-if`
204205

205-
**Optional** Allows you to define conditions for the `post:` action execution. The `post:` action will only run if the conditions in `post-if` are met. If not set, then `post-if` defaults to `always()`.
206+
**Optional** Allows you to define conditions for the `post:` action execution. The `post:` action will only run if the conditions in `post-if` are met. If not set, then `post-if` defaults to `always()`. In `post-if`, status check functions evaluate against the job's status, not the action's own status.
206207

207208
For example, this `cleanup.js` will only run on Linux-based runners:
208209

@@ -265,6 +266,35 @@ For more information, see "[`github context`](/actions/reference/context-and-exp
265266
**Required** The shell where you want to run the command. You can use any of the shells listed [here](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsshell). Required if `run` is set.
266267
{% endif %}
267268

269+
#### `runs.steps[*].if`
270+
271+
**Optional** You can use the `if` conditional to prevent a step from running unless a condition is met. You can use any supported context and expression to create a conditional.
272+
273+
{% data reusables.github-actions.expression-syntax-if %} For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
274+
275+
**Example: Using contexts**
276+
277+
This step only runs when the event type is a `pull_request` and the event action is `unassigned`.
278+
279+
```yaml
280+
steps:
281+
- run: echo This event is a pull request that had an assignee removed.
282+
if: {% raw %}${{ github.event_name == 'pull_request' && github.event.action == 'unassigned' }}{% endraw %}
283+
```
284+
285+
**Example: Using status check functions**
286+
287+
The `my backup step` only runs when the previous step of a composite action fails. For more information, see "[Expressions](/actions/learn-github-actions/expressions#job-status-check-functions)."
288+
289+
```yaml
290+
steps:
291+
- name: My first step
292+
uses: octo-org/action-name@main
293+
- name: My backup step
294+
if: {% raw %}${{ failure() }}{% endraw %}
295+
uses: actions/heroku@1.0.0
296+
```
297+
268298
#### `runs.steps[*].name`
269299

270300
**Optional** The name of the composite step.

0 commit comments

Comments
 (0)