From ad806d6cd7ee056cee1dea83bd4784673c3b843c Mon Sep 17 00:00:00 2001 From: cryptodev-2s <109512101+cryptodev-2s@users.noreply.github.com> Date: Wed, 24 Jul 2024 14:57:46 +0200 Subject: [PATCH] fix: attribution link (#10365) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** - Update the attribution link to match the current app version. - The update-attributions workflow was using a low-privilege token for checking out the repository. The checkout step is what determines which credentials are used upon push. The later step with git push well fail with a HTTP 403 response despite having a token declared with write access, because git push uses the credentials setup during checkout. ## **Related issues** Fixes: [#1829](https://github.com/MetaMask/mobile-planning/issues/1829) ## **Manual testing steps** 1. Go to`Settings` Page. 2. Scroll down and click on `About Metamask`. 3. Click on `Attributions`. 4. You should then be redirected to https://raw.githubusercontent.com/MetaMask/metamask-mobile/v7.27.0/attribution.txt (where v7.27.0 is the current Metamask Mobile version) ## **Screenshots/Recordings** ### **Before** https://github.com/user-attachments/assets/99acf283-a3df-4332-b8f9-85b622f1a838 ### **After** https://github.com/user-attachments/assets/7db6972e-96c7-4689-8c1b-2802704bb886 ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .github/workflows/update-attributions.yml | 4 +--- app/components/Views/Settings/AppInformation/index.js | 9 ++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-attributions.yml b/.github/workflows/update-attributions.yml index 101270ac270..54f02610689 100644 --- a/.github/workflows/update-attributions.yml +++ b/.github/workflows/update-attributions.yml @@ -113,7 +113,7 @@ jobs: uses: actions/checkout@v4 with: # Use PAT to ensure that the commit later can trigger status check workflows - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.ACTIONS_WRITE_TOKEN }} - name: Checkout pull request run: gh pr checkout "${PR_NUMBER}" env: @@ -144,8 +144,6 @@ jobs: git config --global user.email 'metamaskbot@users.noreply.github.com' git commit -am "Update Attributions" git push - env: - GITHUB_TOKEN: ${{ secrets.ACTIONS_WRITE_TOKEN }} - name: Post comment run: | if [[ $HAS_CHANGES == 'true' ]] diff --git a/app/components/Views/Settings/AppInformation/index.js b/app/components/Views/Settings/AppInformation/index.js index 345a2fe9107..6aa0694d672 100644 --- a/app/components/Views/Settings/AppInformation/index.js +++ b/app/components/Views/Settings/AppInformation/index.js @@ -100,6 +100,7 @@ export default class AppInformation extends PureComponent { state = { appInfo: '', + appVersion: '', }; updateNavBar = () => { @@ -120,7 +121,10 @@ export default class AppInformation extends PureComponent { const appName = await getApplicationName(); const appVersion = await getVersion(); const buildNumber = await getBuildNumber(); - this.setState({ appInfo: `${appName} v${appVersion} (${buildNumber})` }); + this.setState({ + appInfo: `${appName} v${appVersion} (${buildNumber})`, + appVersion, + }); }; componentDidUpdate = () => { @@ -150,8 +154,7 @@ export default class AppInformation extends PureComponent { }; onAttributions = () => { - const url = - 'https://raw.githubusercontent.com/MetaMask/metamask-mobile/main/attribution.txt'; + const url = `https://raw.githubusercontent.com/MetaMask/metamask-mobile/v${this.state.appVersion}/attribution.txt`; this.goTo(url, strings('app_information.attributions')); };