-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
chore: use GitHub application token #3616
Draft
petertonysmith94
wants to merge
4
commits into
master
Choose a base branch
from
ps/chore/use-github-application-token
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0b29042
chore: remove GitHub PAT token usage
petertonysmith94 bbb28f7
chore: updated release to application token
petertonysmith94 e772e20
Merge branch 'master' of github.com:FuelLabs/fuels-ts into ps/chore/u…
petertonysmith94 b212d38
chore: update changeset
petertonysmith94 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,11 +19,20 @@ jobs: | |
if: github.event.before != '0000000000000000000000000000000000000000' | ||
|
||
steps: | ||
- name: Create GitHub App Token | ||
uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ vars.APP_ID }} | ||
private-key: ${{ secrets.PRIVATE_KEY }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config | ||
persist-credentials: false | ||
|
||
- name: CI Setup | ||
uses: ./.github/actions/ci-setup | ||
|
@@ -37,7 +46,7 @@ jobs: | |
echo "FORC_VERSION=$(cat ./internal/forc/VERSION)" >> $GITHUB_ENV | ||
git reset --hard | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
petertonysmith94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Ensure NPM access | ||
run: npm whoami | ||
|
@@ -59,7 +68,7 @@ jobs: | |
pnpm add --global semver | ||
echo "RELEASE_VERSION_HIGHER_THAN_LATEST=$(semver $LATEST_RELEASE $RELEASE_VERSION | tail -n1 | grep ${RELEASE_VERSION#v} --silent && echo true || echo false)" >> $GITHUB_ENV | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
petertonysmith94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Create Release Pull Request or Publish to npm | ||
id: changesets | ||
|
@@ -73,13 +82,13 @@ jobs: | |
githubReleaseName: ${{ env.RELEASE_VERSION }} | ||
githubTagName: ${{ env.RELEASE_VERSION }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
petertonysmith94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Prettify changelog | ||
run: pnpm changeset:update-changelog | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
petertonysmith94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
RELEASE_TAG: ${{ env.RELEASE_VERSION }} | ||
PUBLISHED: ${{ steps.changesets.outputs.published }} | ||
REF_NAME: ${{ github.ref_name }} | ||
|
@@ -109,7 +118,7 @@ jobs: | |
pnpm changeset publish --tag next | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of these changes don't look like they need an app - only the stuff doing anything to other repos should need special access. The default token should work fine for changes to this repo. |
||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
petertonysmith94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# ensure docs are always deployed after merge of changeset PR | ||
- name: Get the last commit message and set env vars | ||
|
@@ -126,7 +135,7 @@ jobs: | |
workflow: update-nightly.yml | ||
ref: master | ||
repo: FuelLabs/docs-hub | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
token: ${{ steps.app-token.outputs.token }} | ||
petertonysmith94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Create PR to apply latest release to master | ||
if: steps.changesets.outputs.published == 'true' && startsWith(github.ref_name, 'release/') && env.RELEASE_VERSION_HIGHER_THAN_LATEST == 'true' | ||
|
@@ -142,7 +151,7 @@ jobs: | |
|
||
gh pr create -B master -H $GITHUB_REF_NAME --title "$PR_TITLE" --body "$PR_BODY" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
petertonysmith94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | ||
LATEST_VERSION: ${{ env.LATEST_VERSION }} | ||
|
||
|
@@ -152,7 +161,7 @@ jobs: | |
if: steps.changesets.outputs.published == 'true' && startsWith(github.ref_name, 'release/') && env.RELEASE_VERSION_HIGHER_THAN_LATEST == 'false' | ||
run: git push origin --delete ${{ github.ref_name }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
petertonysmith94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Upload assets to S3 | ||
- uses: unfor19/[email protected] | ||
|
@@ -182,6 +191,6 @@ jobs: | |
run: | | ||
curl -X POST \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: token ${{ secrets.MIGRATIONS_RELEASE_TRIGGER_TOKEN }}" \ | ||
-H "Authorization: token ${{ steps.app-token.outputs.token }}" \ | ||
https://api.github.com/repos/FuelLabs/migrations-and-disclosures/dispatches \ | ||
petertonysmith94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-d '{"event_type":"update_versions"}' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is happening in this workflow that requires an app token? It looks like it's only manipulating the contents of the current repo, which should be a matter of adjusting the existing token permissions, not using an app.