Initialise Repo #7
Workflow file for this run
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: Initialise Repo | |
on: | |
create: | |
branches: | |
# NB: its difficult to get the default branch dynamically in | |
# push event, so it has been hardcoded. | |
# ${{ github.event.repository.default_branch }} does not | |
# work in this scenario. | |
# | |
- master | |
permissions: | |
contents: write | |
jobs: | |
run-script: | |
name: run auto-check script | |
# We will only run this action when this repository isn't the | |
# template repository | |
# | |
if: >- | |
${{ !github.event.repository.is_template }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure Git | |
run: | | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global user.email "${GITHUB_ACTOR_EMAIL}" | |
shell: bash | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
- name: Run Auto Check script | |
run: | | |
. ./scripts/automate-checklist.sh | |
auto-check | |
shell: bash | |
- name: Go Format | |
run: | | |
go fmt ./... | |
shell: bash | |
- name: Clean up redundant scripts | |
run: | | |
rm -fv .github/workflows/auto-check-workflow.yml 2>/dev/null | |
rm -fv ./scripts/automate-checklist.sh 2>/dev/null | |
shell: bash | |
- name: Add files and commit changes | |
run: | | |
git add . | |
git commit -m "chore(gh-actions): apply auto-check edits" | |
git push -u origin ${{ github.event.repository.default_branch }} | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |