mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-02 22:13:11 -05:00
dev: Bunch of GH workflow fixes (#6956)
This commit is contained in:
11
.github/workflows/auto-merge-l10n.yml
vendored
11
.github/workflows/auto-merge-l10n.yml
vendored
@@ -72,6 +72,17 @@ jobs:
|
|||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
|
APPROVED=$(gh pr view "$PR_NUMBER" \
|
||||||
|
--repo "$REPO" \
|
||||||
|
--json reviews \
|
||||||
|
--jq '.reviews[] | select(.state == "APPROVED") | .id' \
|
||||||
|
| wc -l)
|
||||||
|
|
||||||
|
if [ "$APPROVED" -gt 0 ]; then
|
||||||
|
echo "PR already approved"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
gh pr review "$PR_NUMBER" \
|
gh pr review "$PR_NUMBER" \
|
||||||
--repo "$REPO" \
|
--repo "$REPO" \
|
||||||
--approve \
|
--approve \
|
||||||
|
|||||||
1
.github/workflows/pull-requests.yml
vendored
1
.github/workflows/pull-requests.yml
vendored
@@ -16,6 +16,7 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
pull-request-lint:
|
pull-request-lint:
|
||||||
name: "Lint PR"
|
name: "Lint PR"
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
uses: ./.github/workflows/pull-request-lint.yml
|
uses: ./.github/workflows/pull-request-lint.yml
|
||||||
|
|
||||||
backend-tests:
|
backend-tests:
|
||||||
|
|||||||
51
.github/workflows/scheduled-checks.yml
vendored
51
.github/workflows/scheduled-checks.yml
vendored
@@ -40,12 +40,18 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: pre-commit autoupdate --color=always
|
run: pre-commit autoupdate --color=always
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Generate GitHub App Token
|
||||||
uses: peter-evans/create-pull-request@v6
|
id: app-token
|
||||||
# This doesn't currently work for us because it creates the PR but the workflows don't run.
|
uses: actions/create-github-app-token@v1
|
||||||
# TODO: Provide a personal access token as a parameter here, that solves that problem.
|
|
||||||
# https://github.com/peter-evans/create-pull-request
|
|
||||||
with:
|
with:
|
||||||
|
app-id: ${{ secrets.COMMIT_BOT_APP_ID }}
|
||||||
|
private-key: ${{ secrets.COMMIT_BOT_APP_PRIVATE_KEY }}
|
||||||
|
|
||||||
|
- name: Create Pull Request
|
||||||
|
id: create-pr
|
||||||
|
uses: peter-evans/create-pull-request@v6
|
||||||
|
with:
|
||||||
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
commit-message: "Update pre-commit hooks"
|
commit-message: "Update pre-commit hooks"
|
||||||
branch: "fix/update-pre-commit-hooks"
|
branch: "fix/update-pre-commit-hooks"
|
||||||
labels: |
|
labels: |
|
||||||
@@ -54,3 +60,38 @@ jobs:
|
|||||||
base: mealie-next
|
base: mealie-next
|
||||||
title: "chore(auto): Update pre-commit hooks"
|
title: "chore(auto): Update pre-commit hooks"
|
||||||
body: "Auto-generated by `.github/workflows/scheduled-checks.yml`"
|
body: "Auto-generated by `.github/workflows/scheduled-checks.yml`"
|
||||||
|
|
||||||
|
- name: Approve PR
|
||||||
|
if: steps.create-pr.outputs.pull-request-number
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
APPROVED=$(gh pr view "$PR_NUMBER" \
|
||||||
|
--repo "$REPO" \
|
||||||
|
--json reviews \
|
||||||
|
--jq '.reviews[] | select(.state == "APPROVED") | .id' \
|
||||||
|
| wc -l)
|
||||||
|
|
||||||
|
if [ "$APPROVED" -gt 0 ]; then
|
||||||
|
echo "PR already approved"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh pr review "$PR_NUMBER" \
|
||||||
|
--repo "$REPO" \
|
||||||
|
--approve \
|
||||||
|
--body "Auto-approved: Pre-commit hook updates"
|
||||||
|
|
||||||
|
- name: Enable auto-merge
|
||||||
|
if: steps.create-pr.outputs.pull-request-number
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
gh pr merge "$PR_NUMBER" \
|
||||||
|
--repo "$REPO" \
|
||||||
|
--auto \
|
||||||
|
--squash
|
||||||
|
|||||||
Reference in New Issue
Block a user