rm .no-release #27
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: apply template | |
on: | |
push: | |
branches: | |
- main | |
permissions: write-all | |
concurrency: | |
group: apply-template | |
jobs: | |
apply-template: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: apply template | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
# fetch our branch | |
git fetch origin main | |
# abort if the current commit is no longer the head of main, because this has already run | |
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/main)" ]; then | |
echo "not on main" | |
exit 0 | |
fi | |
script/apply-template | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git commit -m 'apply template' | |
# do not push if this repo is a template | |
IS_TEMPLATE="$(gh repo view --json isTemplate --jq '.isTemplate')" | |
if [ "$IS_TEMPLATE" = "false" ]; then | |
git push | |
fi |