ci: update global workflows (#547)

This commit is contained in:
LizardByte-bot 2022-12-12 20:04:06 -05:00 committed by GitHub
parent 6f369398b3
commit c60ebb76b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 9 deletions

View File

@ -6,22 +6,46 @@
name: Label PR autoupdate name: Label PR autoupdate
on: on:
pull_request: pull_request_target:
types: types:
- edited - edited
- opened - opened
- synchronize
pull_request_review:
types:
- edited
- submitted
jobs: jobs:
label_pr: label_pr:
if: >- if: >-
startsWith(github.repository, 'LizardByte/') && startsWith(github.repository, 'LizardByte/') &&
contains(github.event.pull_request.body, fromJSON('"] I want maintainers to keep my branch updated\r"')) contains(github.event.pull_request.body, fromJSON('"] I want maintainers to keep my branch updated"'))
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps: steps:
- name: Check if member
id: org_member
run: |
status="true"
gh api \
-H "Accept: application/vnd.github+json" \
/orgs/${{ github.repository_owner }}/members/${{ github.actor }} || status="false"
echo "result=${status}" >> $GITHUB_OUTPUT
- name: Label autoupdate - name: Label autoupdate
if: >- if: >-
steps.org_member.outputs.result == 'true' &&
contains(github.event.pull_request.labels.*.name, 'autoupdate') == false &&
contains(github.event.pull_request.body, contains(github.event.pull_request.body,
fromJSON('"\n- [x] I want maintainers to keep my branch updated\r"')) == true fromJSON('"\n- [x] I want maintainers to keep my branch updated"')) == true &&
(
(github.event_name == 'pull_request_review' && github.event.review.state == 'approved') ||
(github.event_name == 'pull_request')
)
uses: actions/github-script@v6 uses: actions/github-script@v6
with: with:
github-token: ${{ secrets.GH_BOT_TOKEN }} github-token: ${{ secrets.GH_BOT_TOKEN }}
@ -35,9 +59,14 @@ jobs:
- name: Unlabel autoupdate - name: Unlabel autoupdate
if: >- if: >-
contains(github.event.pull_request.body, contains(github.event.pull_request.labels.*.name, 'autoupdate') &&
fromJSON('"\n- [x] I want maintainers to keep my branch updated\r"')) == false && github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'autoupdate') (
(github.event.action == 'synchronize' && steps.org_member.outputs.result == 'false') ||
(contains(github.event.pull_request.body,
fromJSON('"\n- [x] I want maintainers to keep my branch updated"')) == false
)
)
uses: actions/github-script@v6 uses: actions/github-script@v6
with: with:
github-token: ${{ secrets.GH_BOT_TOKEN }} github-token: ${{ secrets.GH_BOT_TOKEN }}

View File

@ -3,8 +3,9 @@
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo. # the above-mentioned repo.
# This workflow is designed to work with: # This workflow is designed to work with the following workflows:
# - automerge workflows # - automerge
# - autoupdate-labeler
# It uses GitHub Action that auto-updates pull requests branches, when changes are pushed to their destination branch. # It uses GitHub Action that auto-updates pull requests branches, when changes are pushed to their destination branch.
# Auto-updating to the latest destination branch works only in the context of upstream repo and not forks. # Auto-updating to the latest destination branch works only in the context of upstream repo and not forks.
@ -34,7 +35,9 @@ jobs:
dependabot-rebase: dependabot-rebase:
name: Dependabot Rebase name: Dependabot Rebase
if: startsWith(github.repository, 'LizardByte/') if: >-
startsWith(github.repository, 'LizardByte/') &&
contains(github.event.pull_request.labels.*.name, 'central_dependency') == false
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: rebase - name: rebase