2021-12-20 01:35:02 -06:00
|
|
|
name: Count Patches
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *'
|
2021-12-21 01:57:57 -06:00
|
|
|
|
2021-12-20 01:35:02 -06:00
|
|
|
env:
|
2022-09-21 23:29:52 -05:00
|
|
|
TAG_COMMIT: d7fb6d9..
|
2022-05-22 02:22:43 -05:00
|
|
|
VERSION_FILE: VERSION.md
|
2021-12-21 01:57:57 -06:00
|
|
|
BRANCH_NAME: patch_update
|
|
|
|
|
2021-12-20 01:35:02 -06:00
|
|
|
jobs:
|
|
|
|
patch-count:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-12-21 01:57:57 -06:00
|
|
|
|
2021-12-20 01:35:02 -06:00
|
|
|
- name: Get latest commit
|
|
|
|
id: log
|
|
|
|
run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)"
|
2021-12-21 01:57:57 -06:00
|
|
|
|
2021-12-20 01:35:02 -06:00
|
|
|
- name: Get repo name
|
|
|
|
id: repo
|
|
|
|
run: echo "::set-output name=message::$GITHUB_REPOSITORY"
|
2021-12-21 01:57:57 -06:00
|
|
|
|
2021-12-20 01:35:02 -06:00
|
|
|
- name: Insert Patch Count
|
|
|
|
if: "!contains(steps.log.outputs.message, 'Updated Patch Count') && contains(steps.repo.outputs.message, 'lnis-uofu/OpenFPGA')"
|
|
|
|
run: |
|
2022-05-22 02:22:43 -05:00
|
|
|
sed -i "s/[0-9]*$/`git log ${TAG_COMMIT} --oneline | wc -l`/" ${VERSION_FILE}
|
2021-12-20 01:35:02 -06:00
|
|
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
git config --local user.name "github-actions[bot]"
|
2022-05-22 02:22:43 -05:00
|
|
|
git add ${VERSION_FILE}
|
2021-12-20 01:35:02 -06:00
|
|
|
git commit -m "Updated Patch Count"
|
2021-12-21 01:57:57 -06:00
|
|
|
|
2021-12-20 01:35:02 -06:00
|
|
|
- name: Push changes # push the output folder to your repo
|
2021-12-21 01:57:57 -06:00
|
|
|
if: "!contains(steps.log.outputs.message, 'Updated Patch Count') && contains(steps.repo.outputs.message, 'lnis-uofu/OpenFPGA')"
|
2021-12-20 01:35:02 -06:00
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
2021-12-20 03:47:34 -06:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2021-12-21 01:57:57 -06:00
|
|
|
branch: ${{env.BRANCH_NAME}}
|
|
|
|
|
|
|
|
- name: Create Auto PR
|
|
|
|
if: "!contains(steps.log.outputs.message, 'Updated Patch Count') && contains(steps.repo.outputs.message, 'lnis-uofu/OpenFPGA')"
|
|
|
|
uses: repo-sync/pull-request@v2
|
|
|
|
with:
|
|
|
|
source_branch: ${{env.BRANCH_NAME}} # name of branch for PR
|
|
|
|
destination_branch: "master" # 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: "tangxifan" # 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
|
2022-02-21 01:32:11 -06:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|