diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1285370..88c8339 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,14 +1,23 @@ +--- # 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. version: 2 updates: + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "daily" + time: "08:00" + target-branch: "nightly" + open-pull-requests-limit: 10 + - package-ecosystem: "github-actions" directory: "/" schedule: interval: "daily" - time: "00:00" + time: "08:30" target-branch: "nightly" open-pull-requests-limit: 10 @@ -16,7 +25,15 @@ updates: directory: "/" schedule: interval: "daily" - time: "00:00" + time: "09:00" + target-branch: "nightly" + open-pull-requests-limit: 10 + + - package-ecosystem: "nuget" + directory: "/" + schedule: + interval: "daily" + time: "09:30" target-branch: "nightly" open-pull-requests-limit: 10 @@ -24,6 +41,14 @@ updates: directory: "/" schedule: interval: "daily" - time: "00:00" + time: "10:00" + target-branch: "nightly" + open-pull-requests-limit: 10 + + - package-ecosystem: "gitsubmodule" + directory: "/" + schedule: + interval: "daily" + time: "10:30" target-branch: "nightly" open-pull-requests-limit: 10 diff --git a/.github/label-actions.yml b/.github/label-actions.yml index 1b6d70f..2949601 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. @@ -24,8 +25,8 @@ invalid:duplicate: invalid:support: comment: > :wave: @{issue-author}, we use the issue tracker exclusively for bug reports. - However, this issue appears to be a support request. Please use - [Discord](https://docs.lizardbyte.dev/about/support.html#discord) for support issues. Thanks. + However, this issue appears to be a support request. Please use our + [Support Center](https://app.lizardbyte.dev/support) for support issues. Thanks. close: true lock: true lock-reason: 'off-topic' diff --git a/.github/pr_release_template.md b/.github/pr_release_template.md index 7c96c6b..b6f6acf 100644 --- a/.github/pr_release_template.md +++ b/.github/pr_release_template.md @@ -17,8 +17,12 @@ This PR was created automatically. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] Dependency update (updates to dependencies) - [ ] Documentation update (changes to documentation) -- [ ] Repository update (changes to repository files) +- [ ] Repository update (changes to repository files, e.g. `.github/...`) + +## Branch Updates +- [x] I want maintainers to keep my branch updated ## Changelog Summary diff --git a/.github/workflows/auto-create-pr.yml b/.github/workflows/auto-create-pr.yml index ef32f2b..811747c 100644 --- a/.github/workflows/auto-create-pr.yml +++ b/.github/workflows/auto-create-pr.yml @@ -1,19 +1,21 @@ +--- # 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 creates a PR automatically when anything is merged/pushed into the `nightly` branch. The PR is created +# against the `master` (default) branch. + name: Auto create PR on: - pull_request: - types: - - closed + push: branches: - 'nightly' jobs: create_pr: - if: github.event.pull_request.merged == true + if: startsWith(github.repository, 'LizardByte/') runs-on: ubuntu-latest steps: @@ -25,7 +27,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 da7b4b0..4774eb2 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -1,7 +1,10 @@ +--- # 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 will, first, automatically approve PRs created by @LizardByte-bot. Then it will automerge relevant PRs. + name: Automerge PR on: @@ -10,45 +13,48 @@ on: - opened - synchronize +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: autoapprove: - if: > + if: >- contains(fromJson('["LizardByte-bot"]'), github.event.pull_request.user.login) && - contains(fromJson('["LizardByte-bot"]'), github.actor) + contains(fromJson('["LizardByte-bot"]'), github.actor) && + startsWith(github.repository, 'LizardByte/') runs-on: ubuntu-latest steps: - - 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: Autoapproving + uses: hmarr/auto-approve-action@v3 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - 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: + if: startsWith(github.repository, 'LizardByte/') needs: [autoapprove] runs-on: ubuntu-latest - concurrency: - group: automerge-${{ github.ref }} - cancel-in-progress: true steps: - name: Automerging - uses: pascalgn/automerge-action@v0.15.3 + uses: pascalgn/automerge-action@v0.15.5 env: BASE_BRANCHES: nightly GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} GITHUB_LOGIN: ${{ secrets.GH_BOT_NAME }} - MERGE_LABELS: "" + MERGE_LABELS: "!dependencies" MERGE_METHOD: "squash" MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})" MERGE_DELETE_BRANCH: true diff --git a/.github/workflows/autoupdate-labeler.yml b/.github/workflows/autoupdate-labeler.yml new file mode 100644 index 0000000..974c9fa --- /dev/null +++ b/.github/workflows/autoupdate-labeler.yml @@ -0,0 +1,72 @@ +--- +# 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. + +# Label PRs with `autoupdate` if various conditions are met, otherwise, remove the label. + +name: Label PR autoupdate + +on: + pull_request_target: + types: + - edited + - opened + - reopened + - synchronize + +jobs: + label_pr: + if: >- + startsWith(github.repository, 'LizardByte/') && + contains(github.event.pull_request.body, fromJSON('"] I want maintainers to keep my branch updated"')) + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + 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 + if: >- + steps.org_member.outputs.result == 'true' && + contains(github.event.pull_request.labels.*.name, 'autoupdate') == false && + contains(github.event.pull_request.body, + fromJSON('"\n- [x] I want maintainers to keep my branch updated"')) == true + 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: ['autoupdate'] + }) + + - name: Unlabel autoupdate + if: >- + 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 + with: + github-token: ${{ secrets.GH_BOT_TOKEN }} + script: | + github.rest.issues.removeLabel({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + name: ['autoupdate'] + }) diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml new file mode 100644 index 0000000..83f4e16 --- /dev/null +++ b/.github/workflows/autoupdate.yml @@ -0,0 +1,51 @@ +--- +# 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 the following workflows: +# - automerge +# - autoupdate-labeler + +# It uses an 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. +# Dependabot PRs are updated by an action that comments `@depdenabot rebase` on dependabot PRs. (disabled) + +name: autoupdate + +on: + push: + branches: + - 'nightly' + +jobs: + autoupdate: + 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: + EXCLUDED_LABELS: "central_dependency,dependencies" + GITHUB_TOKEN: '${{ secrets.GH_BOT_TOKEN }}' + PR_FILTER: "labelled" + PR_LABELS: "autoupdate" + PR_READY_STATE: "all" + MERGE_CONFLICT_ACTION: "fail" + +# Disabled due to: +# - no major version tag, resulting in constant nagging to update this action +# - additionally, the code is sketchy, 16k+ lines of code? +# https://github.com/bbeesley/gha-auto-dependabot-rebase/blob/main/dist/main.cjs +# +# dependabot-rebase: +# name: Dependabot Rebase +# if: >- +# startsWith(github.repository, 'LizardByte/') +# runs-on: ubuntu-latest +# steps: +# - name: rebase +# uses: "bbeesley/gha-auto-dependabot-rebase@v1.3.18" +# env: +# GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} diff --git a/.github/workflows/issues-stale.yml b/.github/workflows/issues-stale.yml index 57b1112..5fe1d77 100644 --- a/.github/workflows/issues-stale.yml +++ b/.github/workflows/issues-stale.yml @@ -1,23 +1,27 @@ +--- # 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. +# Manage stale issues and PRs. + name: Stale Issues / PRs on: schedule: - - cron: '00 00 * * *' + - cron: '00 10 * * *' jobs: stale: name: Check Stale Issues / PRs + if: startsWith(github.repository, 'LizardByte/') runs-on: ubuntu-latest steps: - name: Stale - uses: actions/stale@v5 + uses: actions/stale@v7 with: close-issue-message: > - This issue was closed because it has been stalled for 5 days with no activity. + This issue was closed because it has been stalled for 10 days with no activity. close-pr-message: > This PR was closed because it has been stalled for 10 days with no activity. days-before-stale: 90 @@ -27,15 +31,16 @@ jobs: exempt-pr-labels: 'dependencies,l10n' stale-issue-label: 'stale' stale-issue-message: > - This issue is stale because it has been open for 30 days with no activity. - Comment or remove the stale label, otherwise this will be closed in 5 days. + This issue is stale because it has been open for 90 days with no activity. + Comment or remove the stale label, otherwise this will be closed in 10 days. stale-pr-label: 'stale' stale-pr-message: > This PR is stale because it has been open for 90 days with no activity. Comment or remove the stale label, otherwise this will be closed in 10 days. + repo-token: ${{ secrets.GH_BOT_TOKEN }} - name: Invalid Template - uses: actions/stale@v5 + uses: actions/stale@v7 with: close-issue-message: > This issue was closed because the the template was not completed after 5 days. @@ -51,3 +56,4 @@ jobs: stale-pr-label: 'invalid:template-incomplete' stale-pr-message: > Invalid PR template. + repo-token: ${{ secrets.GH_BOT_TOKEN }} diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 9f4a08d..d7a1025 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -1,21 +1,25 @@ +--- # 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. +# Label and un-label actions using `../label-actions.yml`. + name: Issues on: issues: types: [labeled, unlabeled] discussion: - types: [ labeled, unlabeled ] + types: [labeled, unlabeled] jobs: label: name: Label Actions + if: startsWith(github.repository, 'LizardByte/') runs-on: ubuntu-latest steps: - name: Label Actions - uses: dessant/label-actions@v2 + uses: dessant/label-actions@v3 with: - github-token: ${{ github.token }} + github-token: ${{ secrets.GH_BOT_TOKEN }} diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index 9954387..5824387 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -1,16 +1,22 @@ +--- # 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. +# Ensure PRs are made against `nightly` branch. + name: Pull Requests on: pull_request_target: types: [opened, synchronize, edited, reopened] +# no concurrency for pull_request_target events + jobs: check-pull-request: name: Check Pull Request + if: startsWith(github.repository, 'LizardByte/') runs-on: ubuntu-latest steps: - uses: Vankka/pr-target-branch-action@v2 @@ -18,7 +24,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 0000000..6327d5d --- /dev/null +++ b/.github/workflows/yaml-lint.yml @@ -0,0 +1,66 @@ +--- +# 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. + +# Lint yaml files. + +name: yaml lint + +on: + pull_request: + branches: [master, nightly] + types: [opened, synchronize, reopened] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + yaml-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Find additional files + id: find-files + run: | + # space separated list of files + FILES=.clang-format + + # empty placeholder + FOUND="" + + for FILE in ${FILES}; do + if [ -f "$FILE" ] + then + FOUND="$FOUND $FILE" + fi + done + + echo "found=${FOUND}" >> $GITHUB_OUTPUT + + - 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: + # GitHub uses "on" for workflow event triggers + # .clang-format file has options of "Yes" "No" that will be caught by this, so changed to "warning" + allowed-values: ['true', 'false', 'on'] + check-keys: true + level: warning + file_or_dir: . ${{ steps.find-files.outputs.found }} + + - name: Log + run: | + cat "${{ steps.yaml-lint.outputs.logfile }}" >> $GITHUB_STEP_SUMMARY