R02B09 global (5 km) #48
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: Create branch from issue | |
on: | |
issues: | |
types: [labeled] | |
jobs: | |
createNewBranch: | |
if: github.event.label.name == 'data request' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Create new branch and commit | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email '[email protected]' | |
git checkout -b issue-${{ github.event.issue.number }}/request | |
echo "${{ github.event.issue.number }}" > issue.txt | |
git add issue.txt | |
git commit -m "Add file for issue #${{ github.event.issue.number }}" | |
git push origin issue-${{ github.event.issue.number }}/request | |
- name: Add 'submitted' label to issue | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
labels: ['submitted'] | |
}) |