Skip to content

Commit

Permalink
CIにGitHub AppのTokenを与える (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
massongit authored Feb 10, 2024
1 parent 061ae82 commit dcafd4e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/add-to-task-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ jobs:
if: github.repository == github.event.pull_request.head.repo.full_name
steps:
- uses: actions/[email protected]
- name: Generate a token
id: generate_token
uses: actions/[email protected]
with:
app-id: ${{ secrets.PROJECT_AUTOMATION_APP_ID }}
private-key: ${{ secrets.PROJECT_AUTOMATION_PRIVATE_KEY }}
- uses: ./
with:
github_app_id: ${{ secrets.PROJECT_AUTOMATION_APP_ID }}
github_app_private_key: ${{ secrets.PROJECT_AUTOMATION_PRIVATE_KEY }}
github-token: ${{ steps.generate_token.outputs.token }}
project-url: https://github.com/orgs/dev-hato/projects/1
10 changes: 8 additions & 2 deletions .github/workflows/format-json-yml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@ jobs:
format-json-yml:
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate_token
uses: actions/[email protected]
with:
app-id: ${{ secrets.PROJECT_AUTOMATION_APP_ID }}
private-key: ${{ secrets.PROJECT_AUTOMATION_PRIVATE_KEY }}
- uses: actions/[email protected]
if: github.event_name != 'pull_request' || github.event.action != 'closed'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
token: ${{secrets.CREATE_WORKFLOW_CI_TOKEN}}
token: ${{ steps.generate_token.outputs.token }}
- uses: dev-hato/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
github-token: ${{ steps.generate_token.outputs.token }}
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
17 changes: 4 additions & 13 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,25 @@ name: 'add-to-projects'
author: 'dev-hato Development Team'
description: 'PRやIssueをGitHub Projectsに追加する'
inputs:
github_app_id:
description: 'GitHub App ID'
required: true
github_app_private_key:
description: 'GitHub App Private Key'
github-token: # id of input
description: 'GITHUB_TOKEN'
required: true
project-url:
description: 'GitHub Projects URL'
required: true
runs:
using: "composite"
steps:
- name: Generate token
id: generate_token
uses: tibdex/[email protected]
with:
app_id: ${{ inputs.github_app_id }}
private_key: ${{ inputs.github_app_private_key }}
- name: Remove pull requests and issues from project
uses: actions/[email protected]
env:
PROJECT_URL: ${{ inputs.project-url }}
with:
github-token: ${{ steps.generate_token.outputs.token }}
github-token: ${{ inputs.github-token }}
script: |
const script = require('${{ github.action_path }}/scripts/action/remove_prs_and_issues.js')
await script({github})
- uses: actions/[email protected]
with:
project-url: ${{ inputs.project-url }}
github-token: ${{ steps.generate_token.outputs.token }}
github-token: ${{ inputs.github-token }}

0 comments on commit dcafd4e

Please sign in to comment.