-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into all-contributors/add-HimanshuNarware
- Loading branch information
Showing
21 changed files
with
262 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Merge Active All-Contributors PRs | ||
|
||
on: | ||
schedule: | ||
- cron: '0 */6 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
merge-active-prs: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Merge active PRs | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { data: pullRequests } = await github.rest.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open', | ||
sort: 'created', | ||
direction: 'asc' | ||
}); | ||
for (const pr of pullRequests) { | ||
if (pr.user.login === 'allcontributors[bot]' && pr.mergeable_state === 'clean') { | ||
try { | ||
await github.rest.pulls.merge({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: pr.number, | ||
merge_method: 'squash' | ||
}); | ||
console.log(`Successfully merged PR #${pr.number}`); | ||
} catch (error) { | ||
console.error(`Failed to merge PR #${pr.number}: ${error.message}`); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Auto-Approve and Merge Pull Requests | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
schedule: | ||
- cron: '0 */6 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
auto-approve-and-merge: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PyGithub | ||
run: pip install PyGithub | ||
|
||
- name: Auto-approve and Merge Pull Requests | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
import os | ||
from github import Github | ||
def approve_and_merge_pr(pr): | ||
pr.create_review(event='APPROVE', body='Automatically approved') | ||
print(f"Approved PR #{pr.number}") | ||
if pr.mergeable: | ||
pr.merge(merge_method='squash') | ||
print(f"Merged PR #{pr.number}") | ||
else: | ||
print(f"PR #{pr.number} is not mergeable") | ||
g = Github(os.getenv('GITHUB_TOKEN')) | ||
repo = g.get_repo(os.getenv('GITHUB_REPOSITORY')) | ||
if os.getenv('GITHUB_EVENT_NAME') == 'pull_request': | ||
pr_number = os.getenv('GITHUB_EVENT_PULL_REQUEST_NUMBER') | ||
pr = repo.get_pull(int(pr_number)) | ||
approve_and_merge_pr(pr) | ||
else: | ||
for pr in repo.get_pulls(state='open'): | ||
approve_and_merge_pr(pr) | ||
print("Auto-approval and merge process completed successfully.") | ||
shell: python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.