From 9d24e05b2838a09428873cf63e8bf3514943a655 Mon Sep 17 00:00:00 2001 From: Julia Pampus Date: Thu, 13 Jul 2023 10:22:09 +0200 Subject: [PATCH] feat: replace with reusable workflows --- .github/workflows/close-inactive-issues.yml | 88 --------------------- .github/workflows/discord-webhook.yml | 57 +++---------- .github/workflows/first-interaction.yml | 16 +--- .github/workflows/scan-pull-request.yaml | 34 +------- .github/workflows/stale-bot.yml | 12 +++ 5 files changed, 29 insertions(+), 178 deletions(-) delete mode 100644 .github/workflows/close-inactive-issues.yml create mode 100644 .github/workflows/stale-bot.yml diff --git a/.github/workflows/close-inactive-issues.yml b/.github/workflows/close-inactive-issues.yml deleted file mode 100644 index 51b51af323a..00000000000 --- a/.github/workflows/close-inactive-issues.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Close Inactive Issues -on: - schedule: - - cron: "30 1 * * *" # once a day (1:30 UTC) - workflow_dispatch: # allow manual trigger - -jobs: - close-issues-in-triage: - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - uses: actions/stale@v8 - with: - operations-per-run: 1000 - days-before-issue-stale: 28 - days-before-issue-close: 14 - stale-issue-label: "stale" - stale-issue-message: "This issue is stale because it has been open for 28 days with no activity." - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." - close-issue-reason: 'not_planned' - days-before-pr-stale: -1 # ignore PRs (overwrite default days-before-stale) - days-before-pr-close: -1 # ignore PRs (overwrite default days-before-close) - remove-issue-stale-when-updated: true - exempt-all-issue-milestones: false # issues with assigned milestones will be ignored - only-labels: 'triage' - repo-token: ${{ secrets.GITHUB_TOKEN }} - - close-issues-with-assignee: - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - uses: actions/stale@v8 - with: - operations-per-run: 1000 - days-before-issue-stale: 28 - days-before-issue-close: 7 - stale-issue-label: "stale" - stale-issue-message: "This issue is stale because it has been open for 28 days with no activity." - close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale." - close-issue-reason: 'not_planned' - days-before-pr-stale: -1 # ignore PRs (overwrite default days-before-stale) - days-before-pr-close: -1 # ignore PRs (overwrite default days-before-close) - remove-issue-stale-when-updated: true - exempt-all-issue-milestones: true # issues with assigned milestones will be ignored - exempt-issue-labels: bug # ignore issues labelled as bug - repo-token: ${{ secrets.GITHUB_TOKEN }} - - close-issues-without-assignee: - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - uses: actions/stale@v8 - with: - operations-per-run: 1000 - days-before-issue-stale: 14 - days-before-issue-close: 7 - stale-issue-label: "stale" - stale-issue-message: "This issue is stale because it has been open for 14 days with no activity." - close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale." - close-issue-reason: 'not_planned' - days-before-pr-stale: -1 # ignore PRs (overwrite default days-before-stale) - days-before-pr-close: -1 # ignore PRs (overwrite default days-before-close) - remove-issue-stale-when-updated: true - exempt-all-issue-milestones: true # issues with assigned milestones will be ignored - exempt-all-issue-assignees: true # issues with assignees will be ignored - exempt-issue-labels: bug # ignore issues labelled as bug - repo-token: ${{ secrets.GITHUB_TOKEN }} - - close-inactive-pull-requests: - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: actions/stale@v8 - with: - operations-per-run: 1000 - days-before-issue-stale: -1 # ignore issues (overwrite default days-before-stale) - days-before-issue-close: -1 # ignore issues (overwrite default days-before-close) - stale-pr-label: "stale" - stale-pr-message: "This pull request is stale because it has been open for 7 days with no activity." - close-pr-message: "This pull request was closed because it has been inactive for 7 days since being marked as stale." - days-before-pr-stale: 7 - days-before-pr-close: 7 - remove-pr-stale-when-updated: true - repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/discord-webhook.yml b/.github/workflows/discord-webhook.yml index a9e9dde5772..28f72936647 100644 --- a/.github/workflows/discord-webhook.yml +++ b/.github/workflows/discord-webhook.yml @@ -1,51 +1,12 @@ -name: 'Discord Webhook' +name: Close Inactive Issues + on: - issues: - types: [ opened ] - pull_request_target: - types: [ opened, reopened ] - discussion: - types: [ created ] + schedule: + - cron: "30 1 * * *" # once a day (1:30 UTC) + workflow_dispatch: # allow manual trigger jobs: - message: - runs-on: ubuntu-latest - steps: - - name: New Discussion - uses: tsickert/discord-webhook@v5.3.0 - if: ${{ (github.event_name == 'discussion') }} - with: - webhook-url: ${{ secrets.DISCORD_WEBHOOK_GITHUB }} - avatar-url: https://avatars.githubusercontent.com/u/9919?s=200&v=4 - embed-author-name: ${{ github.event.sender.login }} - embed-author-url: ${{ github.event.sender.html_url }} - embed-author-icon-url: ${{ github.event.sender.avatar_url }} - embed-title: ${{ github.event.discussion.title }} - embed-url: ${{ github.event.discussion.html_url }} - embed-description: A **discussion** has been created in ${{ github.repository }}. - - - name: New Issue - uses: tsickert/discord-webhook@v5.3.0 - if: ${{ (github.event_name == 'issues') }} - with: - webhook-url: ${{ secrets.DISCORD_WEBHOOK_GITHUB }} - avatar-url: https://avatars.githubusercontent.com/u/9919?s=200&v=4 - embed-author-name: ${{ github.event.sender.login }} - embed-author-url: ${{ github.event.sender.html_url }} - embed-author-icon-url: ${{ github.event.sender.avatar_url }} - embed-title: ${{ github.event.issue.title }} - embed-url: ${{ github.event.issue.html_url }} - embed-description: An **issue** has been opened in ${{ github.repository }}. - - - name: New Pull Request - uses: tsickert/discord-webhook@v5.3.0 - if: ${{ (github.event_name == 'pull_request_target') }} - with: - webhook-url: ${{ secrets.DISCORD_WEBHOOK_GITHUB }} - avatar-url: https://avatars.githubusercontent.com/u/9919?s=200&v=4 - embed-author-name: ${{ github.event.sender.login }} - embed-author-url: ${{ github.event.sender.html_url }} - embed-author-icon-url: ${{ github.event.sender.avatar_url }} - embed-title: ${{ github.event.pull_request.title }} - embed-url: ${{ github.event.pull_request.html_url }} - embed-description: A **pull request** has been opened in ${{ github.repository }}. + trigger-workflow: + uses: eclipse-edc/.github/.github/workflows/stale-bot.yml@main + secrets: + envGH: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/first-interaction.yml b/.github/workflows/first-interaction.yml index ef1a25be42a..b1daff14f56 100644 --- a/.github/workflows/first-interaction.yml +++ b/.github/workflows/first-interaction.yml @@ -7,15 +7,7 @@ on: types: [ opened ] jobs: - add-comment: - runs-on: ubuntu-latest - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: 'Thanks for your contribution :fire: We will take a look asap :rocket:' - pr-message: >- - We are always happy to welcome new contributors :heart: To make things easier for everyone, please - make sure to follow our [contribution guidelines](https://github.com/eclipse-edc/Connector/blob/main/CONTRIBUTING.md), - check if you have already signed the [ECA](http://www.eclipse.org/legal/ecafaq.php), and - relate this pull request to an existing issue or discussion. + trigger-workflow: + uses: eclipse-edc/.github/.github/workflows/first-interaction.yml@main + secrets: + envGH: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/scan-pull-request.yaml b/.github/workflows/scan-pull-request.yaml index 2346035243d..5ad1602dfbe 100644 --- a/.github/workflows/scan-pull-request.yaml +++ b/.github/workflows/scan-pull-request.yaml @@ -10,33 +10,7 @@ concurrency: cancel-in-progress: true jobs: - check-pull-request-title: - runs-on: ubuntu-latest - continue-on-error: false - steps: - - uses: deepakputhraya/action-pr-title@master - with: - # Match pull request titles conventional commit syntax (https://www.conventionalcommits.org/en/v1.0.0/) - # (online tool for regex quick check: https://regex101.com/r/V5J8kh/1) - # - # Valid examples would be - # - fix: resolve minor issue - # - docs(Sample5): update docs for configuration - # - feat(management-api)!: change path to access contract agreements - # - # Invalid examples would be - # - Add cool feature - # - Feature/some cool improvement - # - fix: resolve minor issue. - regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+((,|\/|\\)?\s?\w+)+\))?!?: [\S ]{1,80}[^\.]$' - allowed_prefixes: 'build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test' - prefix_case_sensitive: true - - check-for-assigned-labels: - runs-on: ubuntu-latest - continue-on-error: false - steps: - - uses: agilepathway/label-checker@v1.4.30 - with: - any_of: api,bug,build,dependencies,documentation,enhancement,no-changelog,refactoring - repo_token: ${{ secrets.GITHUB_TOKEN }} + trigger-workflow: + uses: eclipse-edc/.github/.github/workflows/scan-pull-request.yml@main + secrets: + envGH: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/stale-bot.yml b/.github/workflows/stale-bot.yml new file mode 100644 index 00000000000..28f72936647 --- /dev/null +++ b/.github/workflows/stale-bot.yml @@ -0,0 +1,12 @@ +name: Close Inactive Issues + +on: + schedule: + - cron: "30 1 * * *" # once a day (1:30 UTC) + workflow_dispatch: # allow manual trigger + +jobs: + trigger-workflow: + uses: eclipse-edc/.github/.github/workflows/stale-bot.yml@main + secrets: + envGH: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file