Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

start-new-engineering-pr-workflow.yml 2.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  1. name: Start new engineering PR workflow
  2. on:
  3. pull_request_target:
  4. types:
  5. - opened
  6. - reopened
  7. jobs:
  8. triage:
  9. if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
  10. runs-on: ubuntu-latest
  11. continue-on-error: true
  12. env:
  13. DRAFT_COLUMN_ID: 10095775
  14. REGULAR_COLUMN_ID: 10095779
  15. steps:
  16. - uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
  17. continue-on-error: true
  18. with:
  19. github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
  20. script: |
  21. // Only assign the engineering folks
  22. try {
  23. await github.teams.getMembershipForUserInOrg({
  24. org: 'github',
  25. team_slug: 'docs-engineering',
  26. username: context.payload.sender.login,
  27. });
  28. } catch(err) {
  29. return
  30. }
  31. // Set column ID
  32. const column_id = context.payload.pull_request.draft
  33. ? process.env.DRAFT_COLUMN_ID
  34. : process.env.REGULAR_COLUMN_ID
  35. // Try to create the card on the GitHub Project
  36. try {
  37. await github.projects.createCard({
  38. column_id: column_id,
  39. content_type: 'PullRequest',
  40. content_id: context.payload.pull_request.id
  41. });
  42. } catch(error) {
  43. console.log(error);
  44. }
  45. // Try to set the author as the assignee
  46. const owner = context.payload.repository.owner.login
  47. const repo = context.payload.repository.name
  48. try {
  49. await github.issues.addAssignees({
  50. owner: owner,
  51. repo: repo,
  52. issue_number: context.payload.pull_request.number,
  53. assignees: [
  54. context.payload.sender.login
  55. ]
  56. });
  57. } catch(error) {
  58. console.log(error);
  59. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...