Skip to content

Commit a52f765

Browse files
authored
Fix auto approve workflow by using step outputs (#1230)
* Update auto_assign.yml * Update auto_approve_dependency_PRs.yml * Update release_notes.rst * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Create auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_approve_dependency_PRs.yml * Update auto_assign.yml * Update auto_approve_dependency_PRs.yml
1 parent 39ba1ae commit a52f765

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

.github/auto_assign.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Set to author to set pr creator as assignee
2-
addAssignees: author
2+
addAssignees: author

.github/workflows/auto_approve_dependency_PRs.yml

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,19 @@ jobs:
66
build:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
10-
- name: Find dependency PRs
11-
id: find_prs
12-
run: |
13-
gh pr list --author "machineFL" --base main --state open --search "status:success review:required" --limit 1 --json url > dep_PRs_waiting_approval.json
14-
echo "dep_pull_request_url=$(cat dep_PRs_waiting_approval.json | grep -Eo "(https)://[a-zA-Z0-9./?=_%:-]*")" >> $GITHUB_ENV
15-
echo "${{ env.dep_pull_request_url }}"
16-
if [[ "${{ env.dep_pull_request_url }}" -gt 8 ]]; then
17-
echo ::set-output name=dep_pull_request_url::${dep_pull_request_url}
18-
else
19-
echo No matching PR found;
20-
fi
21-
env:
22-
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
23-
- name: Approve dependency PRs and enable auto-merge
24-
if: steps.find_prs.outputs.dep_pull_request_url && steps.find_prs.outputs.dep_pull_request_url != null
25-
run: |
26-
gh pr review ${{ steps.find_prs.outputs.dep_pull_request_url }} --approve --comment --body "auto approve"
27-
gh pr merge ${{ steps.find_prs.outputs.dep_pull_request_url }} --auto --squash
28-
rm dep_PRs_waiting_approval.json
29-
env:
30-
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
9+
- uses: actions/checkout@v2
10+
- name: Find dependency PRs
11+
id: find_prs
12+
run: |
13+
gh pr list --repo "alteryx/woodwork" --author "machineFL" --base main --state open --search "status:success review:required" --limit 1 --json url > dep_PRs_waiting_approval.json
14+
echo ::set-output name=dep_pull_request_url::$(cat dep_PRs_waiting_approval.json | grep -Eo "(https)://[a-zA-Z0-9./?=_%:-]*")
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
17+
- name: Approve dependency PRs and enable auto-merge
18+
if: startsWith( ${{ steps.find_prs.outputs.dep_pull_request_url }}, "https://github.com/alteryx/woodwork/pull/" )
19+
run: |
20+
gh pr review --comment --body "auto approve" ${{ steps.find_prs.outputs.dep_pull_request_url }}
21+
gh pr review --approve ${{ steps.find_prs.outputs.dep_pull_request_url }}
22+
gh pr merge --auto --squash ${{ steps.find_prs.outputs.dep_pull_request_url }}
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.AUTO_APPROVE_TOKEN }}

docs/source/release_notes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Future Release
1111
* Documentation Changes
1212
* Updating contributing doc with Spark installat instructions (:pr:`1232`)
1313
* Testing Changes
14-
* Enable auto-merge for minimum and latest dependency merge requests (:pr:`1228`)
14+
* Enable auto-merge for minimum and latest dependency merge requests (:pr:`1228`, :pr:`1230`)
1515

1616
Thanks to the following people for contributing to this release:
1717
:user:`gsheni`, :user:`willsmithorg`

0 commit comments

Comments
 (0)