diff --git a/.github/label-commenter-config.yml b/.github/label-commenter-config.yml new file mode 100644 index 0000000..d1bc4f1 --- /dev/null +++ b/.github/label-commenter-config.yml @@ -0,0 +1,41 @@ +labels: + - name: "invalid" + labeled: + issue: + body: | + This issue has been closed because you did not provide the requested information. + action: "close" + - name: "support" + labeled: + issue: + body: | + This issue has been closed as we only track bugs here. + + You can get community support on [forums](https://forum.glpi-project.org/) or you can consider [taking a subscription](https://glpi-project.org/subscriptions/) to get professional support. + You can also [contact GLPI editor team](https://glpi-project.org/contact_us/) directly. + action: "close" + - name: "feature suggestion" + labeled: + issue: + body: | + This issue has been closed as we only track bugs here. + + You can open a topic to discuss with community about this enhancement on [suggestion website](https://suggest.glpi-project.org). + You can also [contact GLPI editor team](https://glpi-project.org/contact_us/) directly if you are willing to sponsor this feature. + action: "close" + - name: "not reproducible" + labeled: + issue: + body: | + This issue has been closed because we could not reproduce it on the latest release. + + Feel free to reopen it with the exact steps to reproduce it on the latest release. + action: "close" + - name: "security report" + labeled: + issue: + body: | + This issue has been closed because security problems must not be reported publicly. + + Please edit it to remove the vulnerability details, then report it privately as described in our [security policy](https://github.com/pluginsGLPI/.github/blob/main/SECURITY.md). + action: "close" diff --git a/.github/workflows/close_stale_issue.yml b/.github/workflows/close_stale_issue.yml new file mode 100644 index 0000000..b8c4e50 --- /dev/null +++ b/.github/workflows/close_stale_issue.yml @@ -0,0 +1,52 @@ +name: "Close stale issues and pull requests" + +on: + schedule: + - cron: "0 8 * * *" + +jobs: + stale: + if: github.repository == 'pluginsGLPI/empty' + permissions: + issues: "write" # for actions/stale to close stale issues + pull-requests: "write" # for actions/stale to close stale pull requests + runs-on: "ubuntu-latest" + steps: + - uses: "actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93" # v11.0.0 + with: + stale-issue-message: >- + There has been no activity on this issue for 60 days and therefore it is considered stale + and will be closed automatically in 14 days. + + + If this issue is related to a bug, please try to reproduce on latest release. If the problem persists, + feel free to add a comment to revive this issue. + stale-pr-message: >- + There has been no activity on this pull request for 90 days and therefore it is considered stale + and will be closed automatically in 14 days. + Feel free to add a comment or push new commits to keep it open. + days-before-issue-stale: 60 + days-before-pr-stale: 90 + days-before-close: 14 + exempt-issue-labels: "bug,enhancement,question,security,need feedback" # Issues with "bug", "enhancement", "question" or "security" labels will not be marked as stale, "need feedback" ones are handled by the next step + exempt-pr-labels: "security" # PR with "security" label will not be marked as stale + exempt-draft-pr: true # Draft PR are work in progress. + exempt-all-milestones: true # Do not check issues/PR with defined milestone. + ascending: true # First check older issues/PR. + operations-per-run: 750 # Max API calls per run. + # Shares the "_state" cache of the step above, harmless as long as each run processes every issue + - uses: "actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93" # v11.0.0 + with: + only-labels: "need feedback" + stale-issue-message: >- + The requested information has not been provided for 30 days, + this issue will be closed automatically in 14 days. + close-issue-message: >- + This issue has been closed because the requested information has not been provided. + Feel free to reopen it with the requested information. + days-before-issue-stale: 30 + days-before-issue-close: 14 + days-before-pr-stale: -1 + days-before-pr-close: -1 + ascending: true + operations-per-run: 750 diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 903e4fc..3f23308 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -15,6 +15,11 @@ concurrency: group: "${{ github.workflow }}-${{ github.ref }}" cancel-in-progress: true +# The changelog and plugin manifest checks read the pull request files +permissions: + contents: "read" + pull-requests: "read" + jobs: generate-ci-matrix: name: "Generate CI matrix" diff --git a/.github/workflows/label-commenter.yml b/.github/workflows/label-commenter.yml new file mode 100644 index 0000000..e79ad4d --- /dev/null +++ b/.github/workflows/label-commenter.yml @@ -0,0 +1,23 @@ +name: "Label commenter" + +on: + issues: + types: + - "labeled" + +jobs: + comment: + # Labels of label-commenter-config.yml, any other label would start a no-op runner + if: contains(fromJSON('["invalid", "support", "feature suggestion", "not reproducible", "security report"]'), github.event.label.name) + permissions: + contents: "read" + issues: "write" + runs-on: "ubuntu-latest" + steps: + - name: "Checkout" + uses: "actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1" # v7.0.1 + with: + persist-credentials: false + + - name: "Label commenter" + uses: "peaceiris/actions-label-commenter@f0dbbef043eb1b150b566db36b0bdc8b7f505579" # v1.10.0 diff --git a/.github/workflows/need-feedback.yml b/.github/workflows/need-feedback.yml new file mode 100644 index 0000000..2c7e7d7 --- /dev/null +++ b/.github/workflows/need-feedback.yml @@ -0,0 +1,23 @@ +name: "Need feedback" + +on: + issue_comment: + types: + - "created" + +jobs: + answered: + if: >- + github.repository == 'pluginsGLPI/empty' + && github.event.comment.user.login == github.event.issue.user.login + && contains(github.event.issue.labels.*.name, 'need feedback') + permissions: + issues: "write" + runs-on: "ubuntu-latest" + steps: + - name: "Remove the need feedback label" + env: + GH_TOKEN: "${{ github.token }}" + GH_REPO: "${{ github.repository }}" + ISSUE_NUMBER: "${{ github.event.issue.number }}" + run: gh issue edit "$ISSUE_NUMBER" --remove-label "need feedback" diff --git a/.glpi-coverage.json b/.glpi-coverage.json.tpl similarity index 100% rename from .glpi-coverage.json rename to .glpi-coverage.json.tpl diff --git a/plugin.sh b/plugin.sh index 6d5cd76..576f787 100755 --- a/plugin.sh +++ b/plugin.sh @@ -61,15 +61,20 @@ if [ -d "$DEST" ]; then exit 1 fi -read -r -p "Does your plugin include JS/TS files? [y/N] " has_js -read -r -p "Does your plugin include CSS/SCSS/SASS/LESS files? [y/N] " has_css +# No stdin (CI init script): `read` fails on EOF, answer the default "N" +read -r -p "Does your plugin include JS/TS files? [y/N] " has_js || true +read -r -p "Does your plugin include CSS/SCSS/SASS/LESS files? [y/N] " has_css || true mkdir "$DEST" rsync_excludes=( --exclude '.git' + --exclude '.github/label-commenter-config.yml' + --exclude '.github/workflows/close_stale_issue.yml' --exclude '.github/workflows/continuous-integration.yml' --exclude '.github/workflows/create-plugin.sh' + --exclude '.github/workflows/label-commenter.yml' + --exclude '.github/workflows/need-feedback.yml' --exclude 'plugin.sh' --exclude 'dist' --exclude 'README.md' diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4ad5437..62f106c 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -34,7 +34,7 @@ $current_plugin_folder = basename(dirname(__DIR__)); require __DIR__ . '/../../../tests/bootstrap.php'; -require dirname(__DIR__) . '/vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; if (!Plugin::isPluginActive($current_plugin_folder)) { throw new RuntimeException(sprintf('Plugin %s is not active in the test database', $current_plugin_folder));