Initial commit #2
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: fmt | |
on: | |
# NOTE: Need to run on a PR so that the ${{ github.head_ref }} (branch) is non-null | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
fmt-code: | |
runs-on: ubuntu-latest | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
# Include the pull request ref in the checkout action to prevent merge commit | |
# https://github.com/actions/checkout?tab=readme-ov-file#checkout-pull-request-head-commit-instead-of-merge-commit | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup git | |
run: echo ${{ github.head_ref || github.ref_name }} | |
- name: Create a change | |
working-directory: code | |
run: | | |
touch test1.txt | |
git add test1.txt | |
# Run steps that make changes to the local repo here. | |
# Commit all changed files back to the repository | |
- uses: planetscale/ghcommit-action@v0.1.6 | |
with: | |
commit_message: "🤖 fmt" | |
repo: ${{ github.repository }} | |
branch: ${{ github.head_ref || github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |