Skip to content

Commit

Permalink
Merge pull request #999 from jonaslagoni/update_with_master_3
Browse files Browse the repository at this point in the history
chore: update with master
  • Loading branch information
derberg committed Dec 4, 2023
2 parents 1a8c669 + 41686ae commit 1a6958b
Show file tree
Hide file tree
Showing 43 changed files with 670 additions and 982 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/add-good-first-issue-labels.yml
Expand Up @@ -4,36 +4,37 @@
# Purpose of this workflow is to enable anyone to label issue with 'Good First Issue' and 'area/*' with a single command.
name: Add 'Good First Issue' and 'area/*' labels # if proper comment added

on:
issue_comment:
types:
- created
on:
issue_comment:
types:
- created

jobs:
add-labels:
if: ${{!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot'}}
if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (contains(github.event.comment.body, '/good-first-issue') || contains(github.event.comment.body, '/gfi' ))}}
runs-on: ubuntu-latest
steps:
- name: Add label
if: contains(github.event.comment.body, '/good-first-issue') || contains(github.event.comment.body, '/gfi' )
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const areas = ['javascript', 'typescript', 'java' , 'go', 'docs', 'ci-cd', 'design'];
const values = context.payload.comment.body.trim().split(" ");
switch(values[1]){
const words = context.payload.comment.body.trim().split(" ");
const areaIndex = words.findIndex((word)=> word === '/gfi' || word === '/good-first-issue') + 1
let area = words[areaIndex];
switch(area){
case 'ts':
values[1] = 'typescript';
area = 'typescript';
break;
case 'js':
values[1] = 'javascript';
area = 'javascript';
break;
case 'markdown':
values[1] = 'docs';
area = 'docs';
break;
}
if(values.length != 2 || !areas.includes(values[1])){
if(!areas.includes(area)){
const message = `Hey @${context.payload.sender.login}, your message doesn't follow the requirements, you can try \`/help\`.`
await github.rest.issues.createComment({
Expand All @@ -44,14 +45,14 @@ jobs:
})
} else {
//remove complexity and areas if there are any before adding new labels;
// remove area if there is any before adding new labels.
const currentLabels = (await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
})).data.map(label => label.name);
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(values[1])));
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(area)));
shouldBeRemoved.forEach(label => {
github.rest.issues.deleteLabel({
owner: context.repo.owner,
Expand All @@ -60,11 +61,11 @@ jobs:
});
});
//add new labels
// Add new labels.
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['good first issue', `area/${values[1]}`]
labels: ['good first issue', `area/${area}`]
});
}
Expand Up @@ -7,14 +7,14 @@

name: Label PRs # if proper comment added

on:
issue_comment:
types:
- created
on:
issue_comment:
types:
- created

jobs:
add-ready-to-merge-label:
if: >
if: >
github.event.issue.pull_request &&
github.event.issue.state != 'closed' &&
github.actor != 'asyncapi-bot' &&
Expand All @@ -25,9 +25,8 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Add ready-to-merge label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand Down Expand Up @@ -64,7 +63,7 @@ jobs:
Thanks 😄`
})
}
add-do-not-merge-label:
if: >
github.event.issue.pull_request &&
Expand All @@ -77,7 +76,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add do-not-merge label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand All @@ -86,7 +85,7 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['do-not-merge']
})
})
add-autoupdate-label:
if: >
github.event.issue.pull_request &&
Expand All @@ -99,7 +98,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add autoupdate label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand All @@ -108,4 +107,4 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['autoupdate']
})
})
2 changes: 1 addition & 1 deletion .github/workflows/automerge-for-humans-merging.yml
Expand Up @@ -43,7 +43,7 @@ jobs:
| join("\n")'
multiline: true
- name: Automerge PR
uses: pascalgn/automerge-action@v0.14.3
uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
MERGE_LABELS: "!do-not-merge,ready-to-merge"
Expand Down
Expand Up @@ -16,20 +16,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Remove label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const labelToRemove = 'ready-to-merge';
const labels = context.payload.pull_request.labels;
const isLabelPresent = labels.some(label => label.name === labelToRemove)
if(!isLabelPresent) return;
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: labelToRemove
})
})
8 changes: 5 additions & 3 deletions .github/workflows/automerge-orphans.yml
Expand Up @@ -13,8 +13,10 @@ jobs:
name: Find orphans and notify
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get list of orphans
uses: actions/github-script@v3
uses: actions/github-script@v6
id: orphans
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -50,10 +52,10 @@ jobs:
}
- if: steps.orphans.outputs.found == 'true'
name: Convert markdown to slack markdown
uses: LoveToKnow/slackify-markdown-action@v1.0.0
uses: asyncapi/.github/.github/actions/slackify-markdown@master
id: issuemarkdown
with:
text: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
markdown: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
- if: steps.orphans.outputs.found == 'true'
name: Send info about orphan to slack
uses: rtCamp/action-slack-notify@v2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/automerge.yml
@@ -1,7 +1,7 @@
# This action is centrally managed in https://github.com/asyncapi/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo.

name: Automerge release bump PR
name: Automerge PRs from bots

on:
pull_request_target:
Expand All @@ -19,12 +19,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Autoapproving
uses: hmarr/auto-approve-action@v2
uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 is used https://github.com/hmarr/auto-approve-action/releases/tag/v3.2.1
with:
github-token: "${{ secrets.GH_TOKEN_BOT_EVE }}"

- name: Label autoapproved
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand All @@ -41,11 +41,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Automerging
uses: pascalgn/automerge-action@v0.13.0
uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
GITHUB_LOGIN: asyncapi-bot
MERGE_LABELS: ""
MERGE_LABELS: "!do-not-merge"
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
MERGE_RETRIES: "20"
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/bump.yml

This file was deleted.

60 changes: 38 additions & 22 deletions .github/workflows/help-command.yml
Expand Up @@ -13,32 +13,48 @@ jobs:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-create-comment@v1
- name: Add comment to PR
uses: actions/github-script@v6
with:
github_token: ${{ secrets.GH_TOKEN }}
body: |
Hello, @${{ github.actor }}! 👋🏼
github-token: ${{ secrets.GH_TOKEN }}
script: |
//Yes to add comment to PR the same endpoint is use that we use to create a comment in issue
//For more details http://developer.github.com/v3/issues/comments/
//Also proved by this action https://github.com/actions-ecosystem/action-create-comment/blob/main/src/main.ts
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Hello, @${{ github.actor }}! 👋🏼
I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand!
At the moment the following comments are supported in pull requests:

- \`/ready-to-merge\` or \`/rtm\` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
- \`/do-not-merge\` or \`/dnm\` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
- \`/autoupdate\` or \`/au\` - This comment will add \`autoupdate\` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.`
})

I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in pull requests:
- `/ready-to-merge` or `/rtm` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
- `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
- `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.
create_help_comment_issue:
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-create-comment@v1
- name: Add comment to Issue
uses: actions/github-script@v6
with:
github_token: ${{ secrets.GH_TOKEN }}
body: |
Hello, @${{ github.actor }}! 👋🏼
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in issues:
- `/good-first-issue {js | ts | java | go | docs | design | ci-cd} ` or `/gfi {js | ts | java | go | docs | design | ci-cd} ` - label an issue as a `good first issue`.
example: `/gfi js` or `/good-first-issue ci-cd`
github-token: ${{ secrets.GH_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Hello, @${{ github.actor }}! 👋🏼
I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand!
At the moment the following comments are supported in issues:

- \`/good-first-issue {js | ts | java | go | docs | design | ci-cd}\` or \`/gfi {js | ts | java | go | docs | design | ci-cd}\` - label an issue as a \`good first issue\`.
example: \`/gfi js\` or \`/good-first-issue ci-cd\``
})

0 comments on commit 1a6958b

Please sign in to comment.