From 4d3c9b0be8c78806e3830daed79f4aa8a77f83ef Mon Sep 17 00:00:00 2001 From: LizardByte-bot <108553330+RetroArcher-bot@users.noreply.github.com> Date: Sun, 7 Aug 2022 23:33:19 +0000 Subject: [PATCH] ci: update global workflows --- .github/dependabot.yml | 1 + .github/label-actions.yml | 1 + .github/workflows/auto-create-pr.yml | 8 ++--- .github/workflows/automerge.yml | 31 ++++++++++--------- .github/workflows/autoupdate.yml | 32 +++++++++++++++++++ .github/workflows/issues-stale.yml | 1 + .github/workflows/issues.yml | 3 +- .github/workflows/pull-requests.yml | 3 +- .github/workflows/yaml-lint.yml | 46 ++++++++++++++++++++++++++++ 9 files changed, 104 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/autoupdate.yml create mode 100644 .github/workflows/yaml-lint.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1285370b..e3b47ad7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,4 @@ +--- # This action is centrally managed in https://github.com//.github/ # 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. diff --git a/.github/label-actions.yml b/.github/label-actions.yml index 1b6d70f1..6d0a74a2 100644 --- a/.github/label-actions.yml +++ b/.github/label-actions.yml @@ -1,3 +1,4 @@ +--- # This action is centrally managed in https://github.com//.github/ # 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. diff --git a/.github/workflows/auto-create-pr.yml b/.github/workflows/auto-create-pr.yml index ef32f2b5..ef19e40f 100644 --- a/.github/workflows/auto-create-pr.yml +++ b/.github/workflows/auto-create-pr.yml @@ -1,3 +1,4 @@ +--- # This action is centrally managed in https://github.com//.github/ # 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. @@ -5,15 +6,12 @@ name: Auto create PR on: - pull_request: - types: - - closed + push: branches: - 'nightly' jobs: create_pr: - if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: @@ -25,7 +23,7 @@ jobs: with: source_branch: "" # should be "nightly" as it's the triggering branch destination_branch: "master" - pr_title: "Pulling ${{ github.ref }} into master" + pr_title: "Pulling ${{ github.ref_name }} into master" pr_template: ".github/pr_release_template.md" pr_assignee: "${{ secrets.GH_BOT_NAME }}" pr_draft: true diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index da7b4b03..7ff83e0a 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -1,3 +1,4 @@ +--- # This action is centrally managed in https://github.com//.github/ # 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. @@ -17,22 +18,22 @@ jobs: contains(fromJson('["LizardByte-bot"]'), github.actor) runs-on: ubuntu-latest steps: - - name: Autoapproving - uses: hmarr/auto-approve-action@v2 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Autoapproving + uses: hmarr/auto-approve-action@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Label autoapproved - uses: actions/github-script@v5 - with: - github-token: ${{ secrets.GH_BOT_TOKEN }} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['autoapproved', 'autoupdate'] - }) + - name: Label autoapproved + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GH_BOT_TOKEN }} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['autoapproved', 'autoupdate'] + }) automerge: needs: [autoapprove] diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml new file mode 100644 index 00000000..f32e65c7 --- /dev/null +++ b/.github/workflows/autoupdate.yml @@ -0,0 +1,32 @@ +--- +# This action is centrally managed in https://github.com//.github/ +# 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. + +# This workflow is designed to work with: +# - automerge workflows + +# 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. + +name: autoupdate + +on: + push: + branches: + - 'nightly' + +jobs: + autoupdate-for-bot: + name: Autoupdate autoapproved PR created in the upstream + if: startsWith(github.repository, 'LizardByte/') + runs-on: ubuntu-latest + steps: + - name: Update + uses: docker://chinthakagodawita/autoupdate-action:v1 + env: + GITHUB_TOKEN: '${{ secrets.GH_BOT_TOKEN }}' + PR_FILTER: "labelled" + PR_LABELS: "autoupdate" + PR_READY_STATE: "ready_for_review" + MERGE_CONFLICT_ACTION: "ignore" diff --git a/.github/workflows/issues-stale.yml b/.github/workflows/issues-stale.yml index 57b11129..225b07de 100644 --- a/.github/workflows/issues-stale.yml +++ b/.github/workflows/issues-stale.yml @@ -1,3 +1,4 @@ +--- # This action is centrally managed in https://github.com//.github/ # 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. diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 9f4a08db..f89975f9 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -1,3 +1,4 @@ +--- # This action is centrally managed in https://github.com//.github/ # 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. @@ -8,7 +9,7 @@ on: issues: types: [labeled, unlabeled] discussion: - types: [ labeled, unlabeled ] + types: [labeled, unlabeled] jobs: label: diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index 99543875..0abc26b8 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -1,3 +1,4 @@ +--- # This action is centrally managed in https://github.com//.github/ # 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. @@ -18,7 +19,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: target: master - exclude: nightly # Don't prevent going from nightly -> master + exclude: nightly # Don't prevent going from nightly -> master change-to: nightly comment: | Your PR was set to `master`, PRs should be sent to `nightly`. diff --git a/.github/workflows/yaml-lint.yml b/.github/workflows/yaml-lint.yml new file mode 100644 index 00000000..83de6c23 --- /dev/null +++ b/.github/workflows/yaml-lint.yml @@ -0,0 +1,46 @@ +--- +# This action is centrally managed in https://github.com//.github/ +# 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. + +name: yaml lint + +on: + pull_request: + branches: [master, nightly] + types: [opened, synchronize, reopened] + +jobs: + yaml-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: yaml lint + id: yaml-lint + uses: ibiqlik/action-yamllint@v3 + with: + # https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration + config_data: | + extends: default + rules: + comments: + level: error + line-length: + max: 120 + truthy: + allowed-values: ['true', 'false', 'on'] # GitHub uses "on" for workflow event triggers + check-keys: true + level: error + + - name: Log + run: | + echo ${{ steps.yaml-lint.outputs.logfile }} + + - name: Upload logs + uses: actions/upload-artifact@v2 + if: failure() + with: + name: yamllint-logfile + path: ${{ steps.yaml-lint.outputs.logfile }}