Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into fix/pre-parsed-doc-input
Browse files Browse the repository at this point in the history
  • Loading branch information
arjungarg07 committed Apr 14, 2022
2 parents 323737d + baef670 commit 2906eec
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,45 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Check if PR is draft or is up-to-date # such info is not available in the context of issue_comment event
- name: Add ready-to-merge label
uses: actions/github-script@v5
id: checkPR
with:
result-encoding: string
github-token: ${{ secrets.GH_TOKEN }}
script: |
let isDraft = false;
let isUpToDate = true;
const prDetailsUrl = context.payload.issue.pull_request.url;
const { data: pull } = await github.request(prDetailsUrl);
isDraft = pull.draft;
const { draft: isDraft} = pull;
if(!isDraft) {
console.log('adding ready-to-merge label...');
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['ready-to-merge']
})
}
const { data: comparison } =
await github.rest.repos.compareCommitsWithBasehead({
owner: pull.head.repo.owner.login,
repo: pull.head.repo.name,
basehead: `${pull.head.label}...${pull.base.label}`,
basehead: `${pull.base.label}...${pull.head.label}`,
});
if (comparison.behind_by !== 0) isUpToDate = false;
return { isDraft, isUpToDate };
- uses: actions-ecosystem/action-create-comment@v1
if: ${{ !steps.checkPR.outputs.result.isUpToDate }}
with:
github_token: ${{ secrets.GH_TOKEN }}
body: |
Hello, @${{ github.actor }}! 👋🏼
This PR is not up to date with the base branch and can't be merged.
You can add comment to this PR with text: `/autoupdate` or `/au`. This way you ask our bot to perform regular updates for you. The only requirement for this to work is to enable [Allow edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) option in your PR. Otherwise the only option that you have is to manually update your branch with latest version of the base branch.
Thanks 😄
- name: Add ready-to-merge label
if: ${{ !steps.checkPR.outputs.result.isDraft }}
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['ready-to-merge']
})
if (comparison.behind_by !== 0) {
console.log(`This branch is behind the target by ${comparison.behind_by} commits`)
console.log('adding out-of-date comment...');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Hello, @${{ github.actor }}! 👋🏼
This PR is not up to date with the base branch and can't be merged.
Please update your branch manually with the latest version of the base branch.
PRO-TIP: Add a comment to your PR with the text: \`/au\` or \`/autoupdate\` and our bot will take care of updating the branch in the future. The only requirement for this to work is to enable [Allow edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) option in your PR.
Thanks 😄`
})
}
add-do-not-merge-label:
if: >
github.event.issue.pull_request &&
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ on:
- 'dependabot/**'
- 'bot/**'
- 'all-contributors/**'
pull_request:
types:
- labeled

jobs:
autoupdate-for-bot:
if: ${{ !github.event.issue.pull_request || contains(github.event.pull_request.labels.*.name, 'autoupdate') }}
name: Autoupdate autoapproved PR created in the upstream
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- `/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. Unless there is a merge conflict.
- `/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.
create_help_comment_issue:
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
runs-on: ubuntu-latest
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/link-check-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ jobs:

# Checks the status of hyperlinks in .md files
- name: Check links
uses: gaurav-nelson/github-action-markdown-link-check@v1
uses: derberg/github-action-markdown-link-check@temporary-fix
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'

# A configuration file can be included, indicating the properties of the link check action
# More information can be found here: https://github.com/tcort/markdown-link-check#config-file-format
# Create mlc_config.json file in the root of the directory

- name: Report workflow run status to Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,action,eventName,ref,workflow
status: ${{ job.status }}
fields: repo,action,workflow
env:
SLACK_DOCS_CHANNEL: ${{ secrets.SLACK_DOCS_CHANNEL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DOCS_CHANNEL }}
if: failure() # Only, on failure, send a message on the Slack Docs Channel (if there are broken links)
13 changes: 10 additions & 3 deletions .github/workflows/link-check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ name: Check Markdown links
on:
pull_request_target:
types: [synchronize, ready_for_review, opened, reopened]
paths:
- '**.md'

jobs:
External-link-validation-on-PR:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@v3
- name: Check links
uses: gaurav-nelson/github-action-markdown-link-check@v1
uses: derberg/github-action-markdown-link-check@temporary-fix
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
check-modified-files-only: 'yes' #Only modified files are checked on PRs
check-modified-files-only: 'yes' # Only modified files are checked on PRs

# A configuration file can be included, indicating the properties of the link check action
# More information can be found here: https://github.com/tcort/markdown-link-check#config-file-format
# Create mlc_config.json file in the root of the directory

0 comments on commit 2906eec

Please sign in to comment.