Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using an app token instead of a PAT #362

Merged
merged 1 commit into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ jobs:

if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 # v1.8.0
with:
app_id: ${{ secrets.FETCH_METADATA_ACTION_AUTOMATION_APP_ID }}
private_key: ${{ secrets.FETCH_METADATA_ACTION_AUTOMATION_PRIVATE_KEY }}

- name: Check out code
uses: actions/checkout@v3

- name: Auto-merge
run: gh pr merge --auto --merge '${{ github.event.pull_request.html_url }}'
env:
GITHUB_TOKEN: ${{ secrets.DEPENDABOT_AUTOMATION_PAT }}
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
11 changes: 9 additions & 2 deletions .github/workflows/dependabot-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ jobs:
# We only need to build the dist/ folder if the PR relates a production NPM dependency, otherwise we don't expect changes.
if: needs.fetch-dependabot-metadata.outputs.package-ecosystem == 'npm_and_yarn' && needs.fetch-dependabot-metadata.outputs.dependency-type == 'direct:production'
steps:
# Check out using a PAT so any pushed changes will trigger checkruns
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 # v1.8.0
with:
app_id: ${{ secrets.FETCH_METADATA_ACTION_AUTOMATION_APP_ID }}
private_key: ${{ secrets.FETCH_METADATA_ACTION_AUTOMATION_PRIVATE_KEY }}

- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.DEPENDABOT_AUTOMATION_PAT }}
# Check out using an app token so any pushed changes will trigger checkruns
token: ${{ steps.generate_token.outputs.token }}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/release-bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 # v1.8.0
with:
app_id: ${{ secrets.FETCH_METADATA_ACTION_AUTOMATION_APP_ID }}
private_key: ${{ secrets.FETCH_METADATA_ACTION_AUTOMATION_PRIVATE_KEY }}

- uses: actions/checkout@v3
with:
# Ensure we start from main in case the workflow is run from a branch
ref: "main"
token: ${{ secrets.DEPENDABOT_AUTOMATION_PAT }}
token: ${{ steps.generate_token.outputs.token }}

- uses: actions/setup-node@v3 # bin/bump-version needs npm
with:
Expand Down Expand Up @@ -66,7 +73,7 @@ jobs:
echo "PR created at URL: $PR_URL"
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.DEPENDABOT_AUTOMATION_PAT }}
GH_TOKEN: ${{ steps.generate_token.outputs.token }}

- name: Set summary
run: |
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release-move-tracking-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ jobs:
# the road we increase the robustness of this.

steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 # v1.8.0
with:
app_id: ${{ secrets.FETCH_METADATA_ACTION_AUTOMATION_APP_ID }}
private_key: ${{ secrets.FETCH_METADATA_ACTION_AUTOMATION_PRIVATE_KEY }}

- uses: actions/checkout@v3
with:
token: ${{ secrets.DEPENDABOT_AUTOMATION_PAT }}
token: ${{ steps.generate_token.outputs.token }}

- name: Move the tracking tag
run: git tag -f v1
Expand Down