chore: use GITHUB_TOKEN auth for Project Beta GitHub Action

This commit is contained in:
Marc Cornellà 2022-01-02 03:09:52 +01:00
parent d1c07f9569
commit 95a66532d1
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B

View file

@ -10,15 +10,9 @@ jobs:
name: Add to project name: Add to project
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@36464acb844fc53b9b8b2401da68844f6b05ebb0
with:
app_id: ${{ secrets.OHMYZSH_BOT_APP_ID }}
private_key: ${{ secrets.OHMYZSH_BOT_APP_PEM }}
- name: Read project data - name: Read project data
env: env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}
ORGANIZATION: ohmyzsh ORGANIZATION: ohmyzsh
PROJECT_NUMBER: "1" PROJECT_NUMBER: "1"
run: | run: |
@ -45,9 +39,10 @@ jobs:
PLUGIN_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json) PLUGIN_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json)
THEME_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Theme") | .id' project_data.json) THEME_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Theme") | .id' project_data.json)
EOF EOF
- name: Add to project - name: Add to project
env: env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}
ISSUE_ID: ${{ github.event.issue.node_id }} ISSUE_ID: ${{ github.event.issue.node_id }}
PR_ID: ${{ github.event.pull_request.node_id }} PR_ID: ${{ github.event.pull_request.node_id }}
run: | run: |
@ -62,10 +57,11 @@ jobs:
' -f project=$PROJECT_ID -f item=${ISSUE_ID:-$PR_ID} --jq '.data.addProjectNextItem.projectNextItem.id')" ' -f project=$PROJECT_ID -f item=${ISSUE_ID:-$PR_ID} --jq '.data.addProjectNextItem.projectNextItem.id')"
echo "ITEM_ID=$item_id" >> $GITHUB_ENV echo "ITEM_ID=$item_id" >> $GITHUB_ENV
- name: Classify Pull Request - name: Classify Pull Request
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
env: env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}
run: | run: |
gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files.[].path' | awk -F/ ' gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files.[].path' | awk -F/ '
/^plugins\// { /^plugins\// {
@ -92,10 +88,11 @@ jobs:
if [[ $(wc -l < themes.list) = 1 ]]; then if [[ $(wc -l < themes.list) = 1 ]]; then
echo "THEME=$(cat themes.list)" >> $GITHUB_ENV echo "THEME=$(cat themes.list)" >> $GITHUB_ENV
fi fi
- name: Fill Pull Request fields in project - name: Fill Pull Request fields in project
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
env: env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}
run: | run: |
gh api graphql -f query=' gh api graphql -f query='
mutation ( mutation (