Skip to content

Commit

Permalink
ci: Update workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Sep 10, 2024
1 parent 34a134f commit 66c7ea0
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/command-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ jobs:
base_ref: ${{ steps.comment-branch.outputs.base_ref }}

steps:
- name: Get repository from pull request comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: get-repository
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const pull = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
const repositoryName = pull.data.head?.repo?.full_name
console.log(repositoryName)
return repositoryName
- name: Disabled on forks
if: ${{ fromJSON(steps.get-repository.outputs.result) != github.repository }}
run: |
echo 'Can not execute /compile on forks'
exit 1
- name: Check actor permission
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
with:
Expand Down Expand Up @@ -95,7 +117,7 @@ jobs:

- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
run: npm i -g 'npm@${{ steps.package-engines-versions.outputs.npmVersion }}'

- name: Rebase to ${{ needs.init.outputs.base_ref }}
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
run: |
Expand All @@ -115,7 +137,7 @@ jobs:
run: |
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
git commit --signoff -m 'chore(assets): Recompile assets'
- name: Commit fixup
if: ${{ contains(needs.init.outputs.arg1, 'fixup') }}
run: |
Expand All @@ -129,7 +151,7 @@ jobs:
git commit --amend --no-edit --signoff
# Remove any [skip ci] from the amended commit
git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
- name: Push normally
if: ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
run: git push origin '${{ needs.init.outputs.head_ref }}'
Expand Down

0 comments on commit 66c7ea0

Please sign in to comment.