From 21c41bc282b6b32c12a0d59c3c8e9f253662cf16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Tue, 5 Nov 2024 13:41:06 +0100 Subject: [PATCH] Remove workflows moved in GHCI --- example-project/.github/workflows/audit.yaml | 49 ----------------- .../.github/workflows/auto-review.yaml | 21 -------- .../.github/workflows/changelog.yaml | 52 ------------------- .../workflows/delete-old-workflows-run.yaml | 20 ------- .../.github/workflows/pr-checks.yaml | 29 ----------- .../workflows/pull-request-automation.yaml | 51 ++++++++++++++++++ 6 files changed, 51 insertions(+), 171 deletions(-) delete mode 100644 example-project/.github/workflows/audit.yaml delete mode 100644 example-project/.github/workflows/auto-review.yaml delete mode 100644 example-project/.github/workflows/changelog.yaml delete mode 100644 example-project/.github/workflows/delete-old-workflows-run.yaml delete mode 100644 example-project/.github/workflows/pr-checks.yaml create mode 100644 example-project/.github/workflows/pull-request-automation.yaml diff --git a/example-project/.github/workflows/audit.yaml b/example-project/.github/workflows/audit.yaml deleted file mode 100644 index 4ad44504e..000000000 --- a/example-project/.github/workflows/audit.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -name: Audit - -on: - schedule: - - cron: '30 2 * * *' - -jobs: - audit: - runs-on: ubuntu-24.04 - name: Audit - timeout-minutes: 10 - - strategy: - fail-fast: false - matrix: - branch: - - '1.0' - - master - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ matrix.branch }} - - - uses: camptocamp/initialise-gopass-summon-action@v2 - with: - ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}} - github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}} - - - run: python3 -m venv ~/.venv - - run: ~/.venv/bin/pip install --pre c2cciutils[audit] - - run: python3 -m pip install --pre c2cciutils[audit] - - - name: Check .tool-versions file existence - id: tool-versions - uses: andstor/file-existence-action@v3 - with: - files: .tool-versions - - uses: asdf-vm/actions/install@v3 - if: steps.tool-versions.outputs.files_exists == 'true' - - run: cat /tmp/python-build.*.log - if: failure() - - run: python --version - - - name: Audit - run: ~/.venv/bin/c2cciutils-audit --branch=${{ matrix.branch }} - env: - GITHUB_TOKEN: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }} diff --git a/example-project/.github/workflows/auto-review.yaml b/example-project/.github/workflows/auto-review.yaml deleted file mode 100644 index 42abba27c..000000000 --- a/example-project/.github/workflows/auto-review.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Auto reviews updates - -on: - pull_request: - types: - - opened - - reopened - - synchronize - -jobs: - auto-merge: - name: Auto reviews updates - runs-on: ubuntu-24.04 - timeout-minutes: 5 - - steps: - - name: Auto reviews updates - uses: golfzaptw/action-auto-reviews-from-branches@master - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - AUTHOR: renovate[bot] diff --git a/example-project/.github/workflows/changelog.yaml b/example-project/.github/workflows/changelog.yaml deleted file mode 100644 index ff79474a9..000000000 --- a/example-project/.github/workflows/changelog.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: Changelog Generator - -on: - schedule: - - cron: '0 0 * * 1' - push: - tags: - - '*.*.*' - -jobs: - changelog: - name: Changelog Generator - runs-on: ubuntu-24.04 - timeout-minutes: 30 - - steps: - - uses: actions/checkout@v4 - if: github.event_name == 'push' && github.ref_type == 'tag' - - name: Create release - run: | - if [[ ${{ github.ref_name }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - gh release create ${{ github.ref_name }} --generate-notes || true - fi - if: github.event_name == 'push' && github.ref_type == 'tag' - env: - GH_TOKEN: ${{ github.token }} - - - name: Get Date - id: get-date - run: | - echo "date=$(/bin/date -u "+%Y%m%d%H%M%S")" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 - with: - path: .cache - key: automation-${{ steps.get-date.outputs.date }} - restore-keys: | - automation- - - - run: docker pull aeonphp/automation - - name: Generate changelog - run: > - docker run --env=AEON_AUTOMATION_GH_TOKEN --rm --volume=$(pwd)/.cache:/cache aeonphp/automation - changelog:generate:all - ${{ github.repository }} - --github-release-update - --cache-path=/cache - --skip-from=dependabot-preview[bot] - --skip-from=dependabot[bot] - --skip-from=renovate[bot] - -v - env: - AEON_AUTOMATION_GH_TOKEN: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }} diff --git a/example-project/.github/workflows/delete-old-workflows-run.yaml b/example-project/.github/workflows/delete-old-workflows-run.yaml deleted file mode 100644 index 10ac70029..000000000 --- a/example-project/.github/workflows/delete-old-workflows-run.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Delete old workflow runs - -on: - schedule: - - cron: '0 0 * * *' - -jobs: - build: - runs-on: ubuntu-24.04 - timeout-minutes: 25 - name: Delete old workflow runs - - steps: - - name: Delete old workflow runs - uses: MajorScruffy/delete-old-workflow-runs@v0.3.0 - with: - repository: ${{ github.repository }} - older-than-seconds: 43200000 # 500 days - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/example-project/.github/workflows/pr-checks.yaml b/example-project/.github/workflows/pr-checks.yaml deleted file mode 100644 index c688f5464..000000000 --- a/example-project/.github/workflows/pr-checks.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: Pull request check - -on: - pull_request: - types: - - opened - - reopened - - labeled - - unlabeled - - edited - - synchronize - -jobs: - build: - name: Pull request check - runs-on: ubuntu-24.04 - timeout-minutes: 5 - - steps: - - uses: actions/checkout@v4 - - - run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH} - - run: python3 -m pip install --user --pre c2cciutils[pr_checks] - - - name: Check pull request - run: c2cciutils-pull-request-checks - env: - GITHUB_EVENT: ${{ toJson(github) }} - GITHUB_TOKEN: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }} diff --git a/example-project/.github/workflows/pull-request-automation.yaml b/example-project/.github/workflows/pull-request-automation.yaml new file mode 100644 index 000000000..6ef14ff19 --- /dev/null +++ b/example-project/.github/workflows/pull-request-automation.yaml @@ -0,0 +1,51 @@ +name: Auto reviews, merge and close pull requests + +on: + pull_request: + types: + - opened + - reopened + +jobs: + auto-merge: + name: Auto reviews pull requests from bots + runs-on: ubuntu-24.04 + timeout-minutes: 5 + + steps: + - name: Print event + run: echo "${GITHUB}" | jq + env: + GITHUB: ${{ toJson(github) }} + - name: Print context + uses: actions/github-script@v7 + with: + script: |- + console.log(context); + - name: Auto reviews GHCI updates + uses: actions/github-script@v7 + with: + script: |- + github.rest.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + event: 'APPROVE', + }) + if: |- + startsWith(github.head_ref, 'ghci/audit/') + && (github.event.pull_request.user.login == 'geo-ghci-test[bot]' + || github.event.pull_request.user.login == 'geo-ghci-int[bot]' + || github.event.pull_request.user.login == 'geo-ghci[bot]') + - name: Auto reviews Renovate updates + uses: actions/github-script@v7 + with: + script: |- + github.rest.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + event: 'APPROVE', + }) + if: |- + github.event.pull_request.user.login == 'renovate[bot]'