Skip to content

Commit

Permalink
feat: skip token creation if credentials missing
Browse files Browse the repository at this point in the history
  • Loading branch information
garryod committed Feb 5, 2025
1 parent 1e227ee commit 63f3bce
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ runs:
steps:
- name: Create GitHub App Token
id: app-token
if: inputs.github-app-id && inputs.github-app-private-key
uses: actions/[email protected]
with:
app-id: ${{ inputs.github-app-id }}
Expand All @@ -57,7 +58,7 @@ runs:
uses: actions/[email protected]
with:
repository: DiamondLightSource/graph-federation
token: ${{ steps.app-token.outputs.token }}
token: ${{ steps.app-token.outputs.token || github.token }}

- name: Download Subgraph schema
uses: actions/[email protected]
Expand Down Expand Up @@ -104,8 +105,9 @@ runs:
name: ${{ inputs.supergraph-schema-artifact }}
path: ./${{ inputs.supergraph-schema-filename }}

- name: Configure Git
- name: Configure Git with App
shell: bash
if: steps.app-token.outcome == 'success'
run: |
USER_ID="$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)"
git config --local user.name "${{ steps.app-token.outputs.app-slug }}[bot]"
Expand All @@ -115,6 +117,7 @@ runs:

- name: Create commit
id: commit
if: steps.app-token.outcome == 'success'
shell: bash
run: |
git checkout -b ${{ inputs.name }}-${{ github.ref_name }}
Expand All @@ -126,7 +129,7 @@ runs:
fi
- name: Create PR
if: inputs.publish == 'true' && steps.commit.outputs.changed == 'true'
if: inputs.publish == 'true' && steps.commit.outputs.changed == 'true' && steps.app-token.outcome == 'success'
shell: bash
run: |
git push origin ${{ inputs.name }}-${{ github.ref_name }} --force-with-lease
Expand Down

0 comments on commit 63f3bce

Please sign in to comment.