From 6fb704b4571bf561618e7340670fc09fdfa40db1 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Thu, 7 Sep 2023 20:39:18 -0600 Subject: [PATCH] Initial commit --- .github/dependabot.yml | 12 +++++ .github/workflows/auto-approve.yml | 19 +++++++ .github/workflows/greetings.yml | 13 +++++ .github/workflows/rebase.yml | 18 +++++++ .github/workflows/sync-release-version.yml | 34 +++++++++++++ .github/workflows/test.yml | 21 ++++++++ .github/workflows/update-readme.yml | 45 +++++++++++++++++ .gitignore | 2 + CONTRIBUTING.md | 0 Dockerfile | 9 ++++ HISTORY.md | 4 ++ LICENSE | 22 ++++++++ README.md | 53 ++++++++++++++++++++ action.yml | 17 +++++++ entrypoint.sh | 3 ++ renovate.json | 58 ++++++++++++++++++++++ 16 files changed, 330 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/auto-approve.yml create mode 100644 .github/workflows/greetings.yml create mode 100644 .github/workflows/rebase.yml create mode 100644 .github/workflows/sync-release-version.yml create mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/update-readme.yml create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 Dockerfile create mode 100644 HISTORY.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 action.yml create mode 100755 entrypoint.sh create mode 100644 renovate.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c30fc17 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: +- package-ecosystem: docker + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml new file mode 100644 index 0000000..0ec12e5 --- /dev/null +++ b/.github/workflows/auto-approve.yml @@ -0,0 +1,19 @@ +name: Auto approve + +on: + pull_request_target + +jobs: + auto-approve: + runs-on: ubuntu-latest + steps: + - uses: hmarr/auto-approve-action@v3 + if: | + github.actor == 'dependabot[bot]' || + github.actor == 'dependabot' || + github.actor == 'dependabot-preview[bot]' || + github.actor == 'dependabot-preview' || + github.actor == 'renovate[bot]' || + github.actor == 'renovate' + with: + github-token: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 0000000..d3ebb71 --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,13 @@ +name: Greetings + +on: [pull_request_target, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience." + pr-message: "Thanks for implementing a fix, could you ensure that the test covers your changes if applicable." diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml new file mode 100644 index 0000000..47b9198 --- /dev/null +++ b/.github/workflows/rebase.yml @@ -0,0 +1,18 @@ +name: Automatic Rebase +on: + issue_comment: + types: [created] +jobs: + rebase: + name: Rebase + if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT_TOKEN }} + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + - name: Automatic Rebase + uses: cirrus-actions/rebase@1.8 + env: + GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/sync-release-version.yml b/.github/workflows/sync-release-version.yml new file mode 100644 index 0000000..94fd997 --- /dev/null +++ b/.github/workflows/sync-release-version.yml @@ -0,0 +1,34 @@ +name: Update release version. +on: + release: + types: [published] + + +jobs: + update-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Run release-tagger + uses: tj-actions/release-tagger@v4 + - name: Sync release version. + uses: tj-actions/sync-release-version@v13 + id: sync-release-version + with: + pattern: '${{ github.repository }}@' + only_major: true + paths: README.md + - name: Run git-cliff + uses: tj-actions/git-cliff@v1 + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + base: "main" + labels: "merge when passing" + title: "Upgraded to ${{ steps.sync-release-version.outputs.new_version }}" + branch: "upgrade-to-${{ steps.sync-release-version.outputs.new_version }}" + commit-message: "Upgraded from ${{ steps.sync-release-version.outputs.old_version }} -> ${{ steps.sync-release-version.outputs.new_version }}" + body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/${{ steps.sync-release-version.outputs.old_version }}...${{ steps.sync-release-version.outputs.new_version }})" + token: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..cecbc1c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + name: Test docker-action + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: shellcheck + uses: reviewdog/action-shellcheck@v1 + - name: Run docker-action + uses: ./ diff --git a/.github/workflows/update-readme.yml b/.github/workflows/update-readme.yml new file mode 100644 index 0000000..3d74ef9 --- /dev/null +++ b/.github/workflows/update-readme.yml @@ -0,0 +1,45 @@ +name: Format README.md + +on: + push: + branches: + - main + +jobs: + sync-assets: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Run auto-doc + uses: tj-actions/auto-doc@v3 + + - name: Run remark + uses: tj-actions/remark@v3 + + - name: Verify Changed files + uses: tj-actions/verify-changed-files@v16 + id: verify_changed_files + with: + files: | + README.md + + - name: README.md changed + if: steps.verify_changed_files.outputs.files_changed == 'true' + run: | + echo "README.md has uncommitted changes" + exit 1 + + - name: Create Pull Request + if: failure() + uses: peter-evans/create-pull-request@v5 + with: + base: "main" + labels: "merge when passing" + title: "Updated README.md" + branch: "chore/update-readme" + commit-message: "Updated README.md" + body: "Updated README.md" + token: ${{ secrets.PAT_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a53c681 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +.envrc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e6e92a2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine:3.18.3 + +LABEL maintainer="Tonye Jack " + +RUN apk add bash + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 0000000..be06502 --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,4 @@ +History +------- + +* Initial Release. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..34a2fdc --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2022, Tonye Jack + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..9ac6ff7 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +[![CI](https://github.com/tj-actions/docker-action/workflows/CI/badge.svg)](https://github.com/tj-actions/docker-action/actions?query=workflow%3ACI) +[![Update release version.](https://github.com/tj-actions/docker-action/workflows/Update%20release%20version./badge.svg)](https://github.com/tj-actions/docker-action/actions?query=workflow%3A%22Update+release+version.%22) +[![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fused-by.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3Dtj-actions%2Fdocker-action%26badge%3Dtrue)](https://github.com/search?o=desc\&q=tj-actions+docker-action+path%3A.github%2Fworkflows+language%3AYAML\&s=\&type=Code) + +## docker-action + +Template Docker action + +```yaml +... + steps: + - uses: actions/checkout@v2 + - name: Docker Action + uses: tj-actions/docker-action@v1 +``` + +## Inputs + + + +| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | +|-------------------------------------------------|--------|----------|-------------------------|----------------------------------------| +| [token](#input_token) | string | true | `"${{ github.token }}"` | GITHUB\_TOKEN or a Repo scoped
PAT | + + + +* Free software: [MIT license](LICENSE) + +If you feel generous and want to show some extra appreciation: + +[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] + +[buymeacoffee]: https://www.buymeacoffee.com/jackton1 + +[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png + +## Features + +* TODO + +## Credits + +This package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter) using [cookiecutter-action](https://github.com/tj-actions/cookiecutter-action) + +## Report Bugs + +Report bugs at https://github.com/tj-actions/docker-action/issues. + +If you are reporting a bug, please include: + +* Your operating system name and version. +* Any details about your workflow that might be helpful in troubleshooting. +* Detailed steps to reproduce the bug. diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..5f91bdb --- /dev/null +++ b/action.yml @@ -0,0 +1,17 @@ +name: Docker Action +description: Template Docker action +author: tj-actions +inputs: + token: + description: 'GITHUB_TOKEN or a Repo scoped PAT' + required: true + default: ${{ github.token }} + +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.token }} +branding: + icon: check-square + color: white diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..df82332 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +set -e diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..cba201d --- /dev/null +++ b/renovate.json @@ -0,0 +1,58 @@ +{ + "extends": [ + "config:base" + ], + "enabled": true, + "prHourlyLimit": 10, + "prConcurrentLimit": 5, + "rebaseWhen": "behind-base-branch", + "addLabels": [ + "dependencies", + "merge when passing" + ], + "assignees": [ + "jackton1" + ], + "assignAutomerge": true, + "dependencyDashboard": true, + "dependencyDashboardAutoclose": true, + "lockFileMaintenance": { + "enabled": true, + "automerge": true + }, + "nvm": { + "enabled": false + }, + "packageRules": [ + { + "matchUpdateTypes": [ + "minor", + "patch", + "pin", + "digest" + ], + "automerge": true, + "rebaseWhen": "behind-base-branch", + "addLabels": [ + "merge when passing" + ] + }, + { + "description": "docker images", + "matchLanguages": [ + "docker" + ], + "matchUpdateTypes": [ + "minor", + "patch", + "pin", + "digest" + ], + "rebaseWhen": "behind-base-branch", + "addLabels": [ + "merge when passing" + ], + "automerge": true + } + ] +}