Count Patches #874
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Count Patches | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
env: | |
TAG_COMMIT: b80be4d.. | |
VERSION_FILE: VERSION.md | |
BRANCH_NAME: patch_update | |
jobs: | |
patch-count: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get latest commit | |
id: log | |
run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)" | |
- name: Get repo name | |
id: repo | |
run: echo "::set-output name=message::$GITHUB_REPOSITORY" | |
- name: Insert Patch Count | |
if: "!contains(steps.log.outputs.message, 'Updated Patch Count')" | |
run: | | |
sed -i "s/[0-9]*$/`git log ${TAG_COMMIT} --oneline | wc -l`/" ${VERSION_FILE} | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add ${VERSION_FILE} | |
git commit -m "Updated Patch Count" | |
- name: Push changes # push the output folder to your repo | |
if: "!contains(steps.log.outputs.message, 'Updated Patch Count')" | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{env.BRANCH_NAME}} | |
- name: Create Auto PR | |
if: "!contains(steps.log.outputs.message, 'Updated Patch Count')" | |
uses: repo-sync/pull-request@v2 | |
with: | |
source_branch: ${{env.BRANCH_NAME}} # name of branch for PR | |
destination_branch: "main" # name of branch on which PR go | |
pr_title: "Pulling ${{ github.ref }} into master" # Title of pull request | |
pr_body: ":crown: *An automated PR*" # Full markdown support, requires pr_title | |
pr_reviewer: "taoli4rs" # Comma-separated list (no spaces) | |
pr_assignee: "nadeemyaseen-rs" # Comma-separated list (no spaces) | |
pr_label: "auto-pr" # Comma-separated list (no spaces) | |
pr_allow_empty: true # Creates pull request even if there are no changes | |
github_token: ${{ secrets.GITHUB_TOKEN }} |