From 7eba13b12c69e63845b6d8bf1d3453edb0549ff9 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Thu, 4 Mar 2021 21:36:52 -0500 Subject: [PATCH] Initial commit. --- .github/ISSUE_TEMPLATE.md | 10 +++++ .github/workflows/rebase.yml | 18 +++++++++ .github/workflows/sync-release-version.yml | 27 +++++++++++++ .github/workflows/test.yml | 21 ++++++++++ .gitignore | 2 + CONTRIBUTING.md | 0 Dockerfile | 9 +++++ HISTORY.md | 7 ++++ LICENSE | 22 ++++++++++ README.md | 47 ++++++++++++++++++++++ action.yml | 17 ++++++++ entrypoint.sh | 3 ++ 12 files changed, 183 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md 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 .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 diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..c29cd592 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,10 @@ +* changed-files: + +### Description + +Describe what you were trying to get done. +Tell us what happened, what went wrong, and what you expected to happen. + +### What I Did + +Add some details about your workflow ? diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml new file mode 100644 index 00000000..4dbe62a5 --- /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@v2 + 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.4 + 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 00000000..f7f78dbd --- /dev/null +++ b/.github/workflows/sync-release-version.yml @@ -0,0 +1,27 @@ +name: Update release version. +on: + release: + types: [published] + + +jobs: + update-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Sync release version + uses: tj-actions/sync-release-version@v8 + id: sync-release-version + with: + pattern: 'tj-actions/changed-files@' + paths: | + README.md + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + base: "main" + 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 00000000..cb69a7ff --- /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 changed-files + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: shellcheck + uses: reviewdog/action-shellcheck@v1 + - name: Run changed-files + uses: ./ diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..a53c6811 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +.envrc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..e69de29b diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..068a1153 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine:3.13.2 + +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 00000000..4d01e237 --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,7 @@ +History +------- + +v1 (2021-03-04) +------------------ + +* Initial Release. diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..3c5778cf --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2021, 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 00000000..1135c794 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +changed-files +------------- + +Get modified files + +```yaml +... + steps: + - uses: actions/checkout@v2 + - name: Get modified files + uses: tj-actions/changed-files@v1 +``` + + +## Inputs + +| Input | type | required | default | description | +|:-------------:|:-----------:|:-------------:|:----------------------------:|:-------------:| +| token | `string` | `true` | `${{ github.token }}` | [GITHUB_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow)
or a repo scoped
[Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) | + + + +* Free software: [MIT license](LICENSE) + +Features +-------- + +* TODO + + +Credits +------- + +This package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter). + + + +Report Bugs +----------- + +Report bugs at https://github.com/tj-actions/changed-files/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 00000000..d2a52f3c --- /dev/null +++ b/action.yml @@ -0,0 +1,17 @@ +name: Get modified files +description: Get modified files +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: git-pull-request + color: white diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..df82332c --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +set -e