-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from unistack-org/master
merge stable
- Loading branch information
Showing
6 changed files
with
78 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,31 @@ | ||
name: "prautomerge" | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["prbuild"] | ||
types: | ||
- completed | ||
pull_request_target: | ||
types: [assigned, opened, synchronize, reopened] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
Dependabot-Automerge: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
# Contains workaround to execute if dependabot updates the PR by checking for the base branch in the linked PR | ||
# The the github.event.workflow_run.event value is 'push' and not 'pull_request' | ||
# dont work with multiple workflows when last returns success | ||
if: >- | ||
github.event.workflow_run.conclusion == 'success' | ||
&& github.actor == 'dependabot[bot]' | ||
&& github.event.sender.login == 'dependabot[bot]' | ||
&& github.event.sender.type == 'Bot' | ||
&& (github.event.workflow_run.event == 'pull_request' | ||
|| (github.event.workflow_run.event == 'push' && github.event.workflow_run.pull_requests[0].base.ref == github.event.repository.default_branch )) | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
steps: | ||
- name: Approve Changes and Merge changes if label 'dependencies' is set | ||
uses: actions/github-script@v5 | ||
- name: metadata | ||
id: metadata | ||
uses: dependabot/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
console.log(context.payload.workflow_run); | ||
var labelNames = await github.paginate( | ||
github.issues.listLabelsOnIssue, | ||
{ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
issue_number: context.payload.workflow_run.pull_requests[0].number, | ||
}, | ||
(response) => response.data.map( | ||
(label) => label.name | ||
) | ||
); | ||
console.log(labelNames); | ||
if (labelNames.includes('dependencies')) { | ||
console.log('Found label'); | ||
await github.pulls.createReview({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
pull_number: context.payload.workflow_run.pull_requests[0].number, | ||
event: 'APPROVE' | ||
}); | ||
console.log('Approved PR'); | ||
await github.pulls.merge({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
pull_number: context.payload.workflow_run.pull_requests[0].number, | ||
}); | ||
console.log('Merged PR'); | ||
} | ||
github-token: "${{ secrets.TOKEN }}" | ||
- name: approve | ||
run: gh pr review --approve "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.TOKEN}} | ||
- name: merge | ||
if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}} | ||
run: gh pr merge --auto --merge "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.TOKEN}} |
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
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