New Project Configuration - [Arlington County E-Bike Voucher Program] #60
This file contains hidden or 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: Convert Issues to JSON Data | |
| on: | |
| issues: | |
| # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues | |
| types: | |
| - opened | |
| - edited | |
| - reopened | |
| - labeled | |
| jobs: | |
| convert_to_config: | |
| if: contains( github.event.issue.title, 'New Project Configuration' ) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: npm i js-yaml @actions/core @actions/github | |
| - name: Create new branch | |
| run: git checkout -b new-config-${{ github.event.issue.number }} | |
| - name: Use local convertIssue action | |
| uses: ./.github/actions/convertIssue | |
| with: | |
| # This controls where the JSON files are generated | |
| folder: "configs/" | |
| # This tells the action which GitHub Issue Form template file to use | |
| issue-template: "add-new-config.yml" | |
| # This controls which property we use to key the file name | |
| hash-property-name: "url_abbreviation" | |
| - name: Generate token to authenticate as op-config-updates GitHub App | |
| id: generate_token | |
| uses: tibdex/github-app-token@v2 | |
| with: | |
| app_id: ${{ secrets.CONFIG_UPDATES_GH_APP_ID }} | |
| private_key: ${{ secrets.CONFIG_UPDATES_GH_APP_PRIVATE_KEY }} | |
| - name: Commit and PR changes | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add configs/ | |
| git commit \ | |
| -m "[${{ env.UrlAbbreviation }}] generate config from #${{ github.event.issue.number }}" \ | |
| -m "- Triggered by creating or updating #${{ github.event.issue.number }}" \ | |
| -m "- Auto-generated by the \`convert-issue-to-json\` workflow" \ | |
| -m "When merged, this will close #${{ github.event.issue.number }}" | |
| git push --set-upstream origin new-config-${{ github.event.issue.number }} | |
| gh pr create --base main --head new-config-${{ github.event.issue.number }} --fill |