Add oyajigyagu 台湾行きたいわん #81
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
# Workflow file for registering dad jokes from issues | |
name: Register oyajigyagu from issues | |
on: | |
issues: | |
types: [opened] | |
permissions: | |
issues: write | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }} | |
jobs: | |
register-dad-jokes: | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.event.issue.title, 'Add oyajigyagu ') }} | |
steps: | |
- name: Check permissions | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea | |
with: | |
script: | | |
const { data: permissions } = await github.rest.repos.getCollaboratorPermissionLevel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
username: context.payload.issue.user.login | |
}); | |
if (permissions.permission !== 'write' && permissions.permission !== 'admin') { | |
throw new Error('User does not have write permissions'); | |
} | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
- name: Install dependencies | |
run: npm install | |
working-directory: .github/scripts | |
- name: Sync database to main branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ISSUE_PAYLOAD: ${{ toJson(github.event.issue) }} | |
run: | | |
node .github/scripts/sync-database.js |