Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit aeaccde

Browse files
asyncapi-botasyncapi-botderberg
authored
ci: update global workflows (#37)
Co-authored-by: asyncapi-bot <[email protected]> Co-authored-by: Lukasz Gornicki <[email protected]>
1 parent 2b404ff commit aeaccde

File tree

6 files changed

+98
-0
lines changed

6 files changed

+98
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#This action is centrally managed in https://github.com/asyncapi/.github/
2+
#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
3+
4+
name: 'Notify on failing automerge'
5+
6+
on:
7+
schedule:
8+
- cron: "0 0 * * *"
9+
10+
jobs:
11+
identify-orphans:
12+
name: Find orphans and notify
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Get list of orphans
16+
uses: actions/github-script@v3
17+
id: orphans
18+
with:
19+
github-token: ${{ secrets.GITHUB_TOKEN }}
20+
script: |
21+
const query = `query($owner:String!, $name:String!) {
22+
repository(owner:$owner, name:$name){
23+
pullRequests(first: 100){
24+
nodes{
25+
title
26+
url
27+
author {
28+
resourcePath
29+
}
30+
state
31+
}
32+
}
33+
}
34+
}`;
35+
const variables = {
36+
owner: context.repo.owner,
37+
name: context.repo.repo
38+
};
39+
const { repository: { pullRequests: { nodes } } } = await github.graphql(query, variables);
40+
41+
let orphans = nodes.filter((pr)=> pr.state === 'OPEN' && (pr.author.resourcePath === '/asyncapi-bot' || pr.author.resourcePath === '/apps/dependabot'))
42+
43+
if (orphans.length) {
44+
core.setOutput('found', 'true');
45+
//Yes, this is very naive approach to assume there is just one PR causing issues, there can be a case that more PRs are affected the same day
46+
//The thing is that handling multiple PRs will increase a complexity in this PR that in my opinion we should avoid
47+
//The other PRs will be reported the next day the action runs, or person that checks first url will notice the other ones
48+
core.setOutput('url', orphans[0].url);
49+
core.setOutput('title', orphans[0].title);
50+
}
51+
- if: steps.orphans.outputs.found == 'true'
52+
name: Convert markdown to slack markdown
53+
uses: LoveToKnow/[email protected]
54+
id: issuemarkdown
55+
with:
56+
text: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
57+
- if: steps.orphans.outputs.found == 'true'
58+
name: Send info about orphan to slack
59+
uses: rtCamp/action-slack-notify@v2
60+
env:
61+
SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}}
62+
SLACK_TITLE: 🚨 Not merged PR that should be automerged 🚨
63+
SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}}
64+
MSG_MINIMAL: true

.github/workflows/automerge.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#This action is centrally managed in https://github.com/asyncapi/.github/
2+
#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
3+
14
name: Automerge release bump PR
25

36
on:

.github/workflows/lint-pr-title.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#This action is centrally managed in https://github.com/asyncapi/.github/
2+
#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
3+
4+
name: Lint PR title
5+
6+
on:
7+
8+
pull_request_target:
9+
types: [opened, reopened, synchronize, edited, ready_for_review]
10+
11+
jobs:
12+
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: amannn/[email protected]
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
19+
with:
20+
subjectPattern: ^(?![A-Z]).+$
21+
subjectPatternError: |
22+
The subject "{subject}" found in the pull request title "{title}" should start with a lowercase character.

.github/workflows/sentiment-analysis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#This action is centrally managed in https://github.com/asyncapi/.github/
2+
#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
3+
14
name: 'Sentiment Analysis'
25

36
on:

.github/workflows/stale-issues-prs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#This action is centrally managed in https://github.com/asyncapi/.github/
2+
#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
3+
14
name: Manage stale issues and PRs
25

36
on:

.github/workflows/welcome-first-time-contrib.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#This action is centrally managed in https://github.com/asyncapi/.github/
2+
#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
3+
14
name: Welcome first time contributors
25

36
on:

0 commit comments

Comments
 (0)