diff --git a/.github/workflows/add-to-task-list.yml b/.github/workflows/add-to-task-list.yml index 5b3c2665..1d9d4722 100644 --- a/.github/workflows/add-to-task-list.yml +++ b/.github/workflows/add-to-task-list.yml @@ -14,8 +14,13 @@ jobs: if: github.repository == github.event.pull_request.head.repo.full_name steps: - uses: actions/checkout@v4.1.1 + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1.7.0 + 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 diff --git a/.github/workflows/format-json-yml.yml b/.github/workflows/format-json-yml.yml index 7c2ead16..9b841ee3 100644 --- a/.github/workflows/format-json-yml.yml +++ b/.github/workflows/format-json-yml.yml @@ -17,15 +17,21 @@ jobs: format-json-yml: runs-on: ubuntu-latest steps: + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1.7.0 + with: + app-id: ${{ secrets.PROJECT_AUTOMATION_APP_ID }} + private-key: ${{ secrets.PROJECT_AUTOMATION_PRIVATE_KEY }} - uses: actions/checkout@v4.1.1 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/actions-format-json-yml@v0.0.59 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 diff --git a/action.yml b/action.yml index 6b4cae1e..1ef8b5a5 100644 --- a/action.yml +++ b/action.yml @@ -2,11 +2,8 @@ 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' @@ -14,22 +11,16 @@ inputs: runs: using: "composite" steps: - - name: Generate token - id: generate_token - uses: tibdex/github-app-token@v2.1.0 - with: - app_id: ${{ inputs.github_app_id }} - private_key: ${{ inputs.github_app_private_key }} - name: Remove pull requests and issues from project uses: actions/github-script@v7.0.1 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/add-to-project@v0.5.0 with: project-url: ${{ inputs.project-url }} - github-token: ${{ steps.generate_token.outputs.token }} + github-token: ${{ inputs.github-token }}