yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
d38fbaefe
master
1name : Format 2on : 3repository_dispatch : 4types : [ format-command ] 5jobs : 6format : 7runs-on : ubuntu-latest 8steps : 9- name : Checkout PR branch 10uses : actions/checkout@v4 11with : 12token : ${{ secrets.SLANGBOT_PAT }} 13repository : ${{ github.event.client_payload.pull_request.head.repo.full_name }} 14ref : ${{ github.event.client_payload.pull_request.head.ref }} 15path : pr-branch 16 17- name : Checkout target branch 18uses : actions/checkout@v4 19with : 20token : ${{ secrets.SLANGBOT_PAT }} 21repository : ${{ github.event.client_payload.pull_request.base.repo.full_name }} 22ref : ${{ github.event.client_payload.pull_request.base.ref }} 23path : target-branch 24 25- name : Setup 26uses : ./target-branch/.github/actions/format-setup 27 28- name : Run formatting 29id : format 30run : | 31./target-branch/extras/formatting.sh --source ./pr-branch 32 33- name : Configure Git commit signing 34id : git-info 35run : | 36echo "${{ secrets.SLANGBOT_SIGNING_KEY }}" > "${{runner.temp}}"/signing_key 37chmod 600 "${{runner.temp}}"/signing_key 38git -C pr-branch config commit.gpgsign true 39git -C pr-branch config gpg.format ssh 40git -C pr-branch config user.signingkey "${{runner.temp}}"/signing_key 41bot_info=$(curl -s -H "Authorization: Bearer ${{ secrets.SLANGBOT_PAT }}" \ 42"https://api.github.com/user") 43echo "bot_identity=$(echo $bot_info | jq --raw-output '.login + " <" + (.id|tostring) + "+" + .login + "@users.noreply.github.com>"')" >> $GITHUB_OUTPUT 44echo "bot_name=$(echo $bot_info | jq --raw-output '.login')" >> $GITHUB_OUTPUT 45 46- name : Create Pull Request 47id : create-pr 48uses : peter-evans/create-pull-request@v7 49with : 50token : ${{ secrets.SLANGBOT_PAT }} 51path : pr-branch 52commit-message : "format code" 53title : "Format code for PR #${{ github.event.client_payload.pull_request.number }}" 54body : "Automated code formatting for ${{ github.event.client_payload.pull_request.html_url }}" 55committer : ${{ steps.git-info.outputs.bot_identity }} 56author : ${{ steps.git-info.outputs.bot_identity }} 57branch : format-${{ github.event.client_payload.pull_request.number }}-${{ github.event.client_payload.pull_request.head.ref }} 58base : ${{ github.event.client_payload.pull_request.head.ref }} 59push-to-fork : ${{ steps.git-info.outputs.bot_name }}/slang 60delete-branch : true 61 62- name : Comment on PR 63uses : peter-evans/create-or-update-comment@v4 64if : always() 65with : 66token : ${{ secrets.SLANGBOT_PAT }} 67repository : ${{ github.event.client_payload.github.payload.repository.full_name }} 68issue-number : ${{ github.event.client_payload.pull_request.number }} 69body : | 70${{ 71steps.format.conclusion == 'failure' 72&& format('❌ Formatting failed. Please check the [workflow run](https://github.com/{0}/actions/runs/{1})', github.repository, github.run_id) 73|| (steps.create-pr.conclusion == 'failure' 74&& format('❌ Failed to create formatting pull request. Please check the [workflow run](https://github.com/{0}/actions/runs/{1})', github.repository, github.run_id) 75|| format('🌈 Formatted, please merge the changes from [this PR]({0})', steps.create-pr.outputs.pull-request-url)) 76}} 77 78- name : Add reaction 79uses : peter-evans/create-or-update-comment@v4 80with : 81token : ${{ secrets.SLANGBOT_PAT }} 82repository : ${{ github.event.client_payload.github.payload.repository.full_name }} 83comment-id : ${{ github.event.client_payload.github.payload.comment.id }} 84reactions-edit-mode : replace 85reactions : hooray