Skip to content

Commit

Permalink
Merge pull request #31575 from Expensify/Rory-GHARelativePaths
Browse files Browse the repository at this point in the history
[No QA] Use relative paths for GitHub Actions
  • Loading branch information
AndrewGable authored Nov 20, 2023
2 parents 2c00104 + 6856964 commit af72c43
Show file tree
Hide file tree
Showing 21 changed files with 85 additions and 76 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,11 @@ In order to bundle actions with their dependencies into a single Node.js executa

- When calling your GitHub Action from one of our workflows, you must:
- First call `@actions/checkout`.
- Use the absolute path of the action in GitHub, including the repo name, path, and branch ref, like so:
- Use the relative path of the action in GitHub from the root of this repo, like so:
```yaml
- name: Generate Version
uses: Expensify/App/.github/actions/javascript/bumpVersion@main
uses: ./.github/actions/javascript/bumpVersion
```
Do not try to use a relative path.
- Confusingly, paths in action metadata files (`action.yml`) _must_ use relative paths.

- You can't use any dynamic values or environment variables in a `uses` statement
- In general, it is a best practice to minimize any side-effects of each action. Using atomic ("dumb") actions that have a clear and simple purpose will promote reuse and make it easier to understand the workflows that use them.
8 changes: 4 additions & 4 deletions .github/workflows/cherryPick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
createNewVersion:
needs: validateActor
if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }}
uses: Expensify/App/.github/workflows/createNewVersion.yml@main
uses: ./.github/workflows/createNewVersion.yml
secrets: inherit

cherryPick:
Expand All @@ -42,15 +42,15 @@ jobs:

- name: Set up git for OSBotify
id: setupGitForOSBotify
uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab
uses: ./.github/actions/composite/setupGitForOSBotifyApp
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
OS_BOTIFY_APP_ID: ${{ secrets.OS_BOTIFY_APP_ID }}
OS_BOTIFY_PRIVATE_KEY: ${{ secrets.OS_BOTIFY_PRIVATE_KEY }}

- name: Get previous app version
id: getPreviousVersion
uses: Expensify/App/.github/actions/javascript/getPreviousVersion@main
uses: ./.github/actions/javascript/getPreviousVersion
with:
SEMVER_LEVEL: "PATCH"

Expand All @@ -67,7 +67,7 @@ jobs:
- name: Get merge commit for pull request to CP
id: getCPMergeCommit
uses: Expensify/App/.github/actions/javascript/getPullRequestDetails@main
uses: ./.github/actions/javascript/getPullRequestDetails
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
USER: ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/createDeployChecklist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Set up git for OSBotify
id: setupGitForOSBotify
uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab
uses: ./.github/actions/composite/setupGitForOSBotifyApp
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
OS_BOTIFY_APP_ID: ${{ secrets.OS_BOTIFY_APP_ID }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/createNewVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }}

- name: Setup git for OSBotify
uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab
uses: ./.github/actions/composite/setupGitForOSBotifyApp
id: setupGitForOSBotify
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
Expand All @@ -85,7 +85,7 @@ jobs:

- name: Generate version
id: bumpVersion
uses: Expensify/App/.github/actions/javascript/bumpVersion@main
uses: ./.github/actions/javascript/bumpVersion
with:
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}
SEMVER_LEVEL: ${{ inputs.SEMVER_LEVEL }}
Expand All @@ -105,6 +105,6 @@ jobs:

- name: Announce failed workflow in Slack
if: ${{ failure() }}
uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main
uses: ./.github/actions/composite/announceFailedWorkflowInSlack
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
ref: staging
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab
- uses: ./.github/actions/composite/setupGitForOSBotifyApp
id: setupGitForOSBotify
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
Expand All @@ -38,7 +38,7 @@ jobs:
ref: production
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab
- uses: ./.github/actions/composite/setupGitForOSBotifyApp
id: setupGitForOSBotify
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
Expand All @@ -50,15 +50,15 @@ jobs:

- name: Get Release Pull Request List
id: getReleasePRList
uses: Expensify/App/.github/actions/javascript/getDeployPullRequestList@main
uses: ./.github/actions/javascript/getDeployPullRequestList
with:
TAG: ${{ env.PRODUCTION_VERSION }}
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}
IS_PRODUCTION_DEPLOY: true

- name: Generate Release Body
id: getReleaseBody
uses: Expensify/App/.github/actions/javascript/getReleaseBody@main
uses: ./.github/actions/javascript/getReleaseBody
with:
PR_LIST: ${{ steps.getReleasePRList.outputs.PR_LIST }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deployExpensifyHelp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup NodeJS
uses: Expensify/App/.github/actions/composite/setupNode@main
uses: ./.github/actions/composite/setupNode

- name: Create docs routes file
run: ./.github/scripts/createDocsRoutes.sh
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/e2ePerformanceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Checkout latest main commit (TODO temporary until new version is released)
run: git switch --detach main

- uses: Expensify/App/.github/actions/composite/setupNode@main
- uses: ./.github/actions/composite/setupNode

- uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
with:
Expand All @@ -64,7 +64,7 @@ jobs:
- name: Build APK
run: npm run android-build-e2e
shell: bash

- name: Upload APK
uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05
with:
Expand All @@ -82,7 +82,7 @@ jobs:

- name: Get pull request details
id: getPullRequestDetails
uses: Expensify/App/.github/actions/javascript/getPullRequestDetails@main
uses: ./.github/actions/javascript/getPullRequestDetails
with:
GITHUB_TOKEN: ${{ github.token }}
PULL_REQUEST_NUMBER: ${{ inputs.PR_NUMBER }}
Expand Down Expand Up @@ -136,13 +136,13 @@ jobs:
with:
ruby-version: "2.7"
bundler-cache: true

- uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef

- name: Build APK
run: npm run android-build-e2edelta
shell: bash

- name: Upload APK
uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05
with:
Expand All @@ -157,7 +157,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Node
uses: Expensify/App/.github/actions/composite/setupNode@main
uses: ./.github/actions/composite/setupNode

- name: Make zip directory for everything to send to AWS Device Farm
run: mkdir zip
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
run: zip -qr App.zip ./zip

- name: Configure AWS Credentials
uses: Expensify/App/.github/actions/composite/configureAwsCredentials@main
uses: ./.github/actions/composite/configureAwsCredentials
with:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/finishReleaseCycle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
ref: main
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab
- uses: ./.github/actions/composite/setupGitForOSBotifyApp
id: setupGitForOSBotify
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
Expand All @@ -38,7 +38,7 @@ jobs:

- name: Reopen and comment on issue (not a team member)
if: ${{ !fromJSON(steps.isDeployer.outputs.IS_DEPLOYER) }}
uses: Expensify/App/.github/actions/javascript/reopenIssueWithComment@main
uses: ./.github/actions/javascript/reopenIssueWithComment
with:
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
Expand All @@ -49,14 +49,14 @@ jobs:
- name: Check for any deploy blockers
if: ${{ fromJSON(steps.isDeployer.outputs.IS_DEPLOYER) }}
id: checkDeployBlockers
uses: Expensify/App/.github/actions/javascript/checkDeployBlockers@main
uses: ./.github/actions/javascript/checkDeployBlockers
with:
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}

- name: Reopen and comment on issue (has blockers)
if: ${{ fromJSON(steps.isDeployer.outputs.IS_DEPLOYER) && fromJSON(steps.checkDeployBlockers.outputs.HAS_DEPLOY_BLOCKERS || 'false') }}
uses: Expensify/App/.github/actions/javascript/reopenIssueWithComment@main
uses: ./.github/actions/javascript/reopenIssueWithComment
with:
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
Expand All @@ -66,7 +66,7 @@ jobs:
- name: Announce failed workflow in Slack
if: ${{ failure() }}
uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main
uses: ./.github/actions/composite/announceFailedWorkflowInSlack
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Expand All @@ -84,7 +84,7 @@ jobs:

- name: Setup Git for OSBotify
id: setupGitForOSBotify
uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab
uses: ./.github/actions/composite/setupGitForOSBotifyApp
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
OS_BOTIFY_APP_ID: ${{ secrets.OS_BOTIFY_APP_ID }}
Expand All @@ -100,15 +100,15 @@ jobs:
- name: Announce failed workflow in Slack
if: ${{ failure() }}
uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main
uses: ./.github/actions/composite/announceFailedWorkflowInSlack
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

# Create a new patch version to prep for next release cycle
createNewPatchVersion:
needs: validate
if: ${{ fromJSON(needs.validate.outputs.isValid) }}
uses: Expensify/App/.github/workflows/createNewVersion.yml@main
uses: ./.github/workflows/createNewVersion.yml
secrets: inherit
with:
SEMVER_LEVEL: PATCH
Expand All @@ -125,7 +125,7 @@ jobs:
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- name: Setup Git for OSBotify
uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab
uses: ./.github/actions/composite/setupGitForOSBotifyApp
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
OS_BOTIFY_APP_ID: ${{ secrets.OS_BOTIFY_APP_ID }}
Expand All @@ -141,6 +141,6 @@ jobs:
- name: Announce failed workflow in Slack
if: ${{ failure() }}
uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main
uses: ./.github/actions/composite/announceFailedWorkflowInSlack
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node
uses: Expensify/App/.github/actions/composite/setupNode@main
uses: ./.github/actions/composite/setupNode

- name: Lint JavaScript and Typescript with ESLint
run: npm run lint
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lockDeploys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- name: Wait for staging deploys to finish
uses: Expensify/App/.github/actions/javascript/awaitStagingDeploys@main
uses: ./.github/actions/javascript/awaitStagingDeploys
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}

Expand All @@ -30,6 +30,6 @@ jobs:

- name: Announce failed workflow
if: ${{ failure() }}
uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main
uses: ./.github/actions/composite/announceFailedWorkflowInSlack
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
18 changes: 9 additions & 9 deletions .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Setup Node
uses: Expensify/App/.github/actions/composite/setupNode@main
uses: ./.github/actions/composite/setupNode

- name: Setup Ruby
uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node
uses: Expensify/App/.github/actions/composite/setupNode@main
uses: ./.github/actions/composite/setupNode

- name: Decrypt Developer ID Certificate
run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Setup Node
uses: Expensify/App/.github/actions/composite/setupNode@main
uses: ./.github/actions/composite/setupNode

- name: Setup Ruby
uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
Expand Down Expand Up @@ -286,13 +286,13 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node
uses: Expensify/App/.github/actions/composite/setupNode@main
uses: ./.github/actions/composite/setupNode

- name: Setup Cloudflare CLI
run: pip3 install cloudflare

- name: Configure AWS Credentials
uses: Expensify/App/.github/actions/composite/configureAwsCredentials@main
uses: ./.github/actions/composite/configureAwsCredentials
with:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down Expand Up @@ -342,7 +342,7 @@ jobs:
needs: [android, desktop, iOS, web]
steps:
- name: Post Slack message on failure
uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main
uses: ./.github/actions/composite/announceFailedWorkflowInSlack
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Expand Down Expand Up @@ -417,21 +417,21 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node
uses: Expensify/App/.github/actions/composite/setupNode@main
uses: ./.github/actions/composite/setupNode

- name: Set version
run: echo "VERSION=$(npm run print-version --silent)" >> "$GITHUB_ENV"

- name: Get Release Pull Request List
id: getReleasePRList
uses: Expensify/App/.github/actions/javascript/getDeployPullRequestList@main
uses: ./.github/actions/javascript/getDeployPullRequestList
with:
TAG: ${{ env.VERSION }}
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
IS_PRODUCTION_DEPLOY: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}

- name: Comment on issues
uses: Expensify/App/.github/actions/javascript/markPullRequestsAsDeployed@main
uses: ./.github/actions/javascript/markPullRequestsAsDeployed
with:
PR_LIST: ${{ steps.getReleasePRList.outputs.PR_LIST }}
IS_PRODUCTION_DEPLOY: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
Expand Down
Loading

0 comments on commit af72c43

Please sign in to comment.