Skip to content

Commit

Permalink
Updates to workflows versions and fix permissions of workflows (#724)
Browse files Browse the repository at this point in the history
* Upgrade workflow checkout and apptoken actions

* Add .env variable to fix action with 403

* Update permissions for workflows
  • Loading branch information
oZakari authored Feb 8, 2024
1 parent 5342278 commit 85f442a
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bicep-build-to-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-ado-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/psdocs-mdtogit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Show env
run: env | sort
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- name: Checkout Repo
id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scheduled-bicep-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/update-policy-china.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,29 @@ jobs:
name: Update Policy Library
if: github.repository == 'Azure/ALZ-Bicep'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:

- name: Local repository checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ github.repository }}
fetch-depth: 0

- name: Remote repository checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: ${{ env.remote_repository }}
path: ${{ env.remote_repository }}
ref: main

- uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Configure local git
run: |
git config user.name github-actions
Expand All @@ -54,7 +62,7 @@ jobs:
fi
working-directory: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

- name: Update Policy Library
uses: azure/powershell@v1
Expand Down Expand Up @@ -96,6 +104,7 @@ jobs:
echo "Pushing changes to origin..."
git add infra-as-code/bicep/modules/policy/definitions/lib/china
git add infra-as-code/bicep/modules/policy/assignments/lib/china
git config --global core.autocrlf input
git commit -m '${{ env.pr_title }}'
git push origin ${{ env.branch_name }}
working-directory: ${{ github.repository }}
Expand All @@ -122,4 +131,4 @@ jobs:
fi
working-directory: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
8 changes: 3 additions & 5 deletions .github/workflows/update-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@ jobs:
permissions:
contents: write
pull-requests: write

steps:

- name: Local repository checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ github.repository }}
fetch-depth: 0

- name: Remote repository checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: ${{ env.remote_repository }}
path: ${{ env.remote_repository }}
ref: main

- uses: tibdex/github-app-token@v1
- uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/wiki-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ jobs:
name: Sync docs/wiki to Wiki
if: github.repository == 'Azure/ALZ-Bicep'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Source Repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: ${{ env.wiki_source_repo }}
path: ${{ env.wiki_source_repo }}

- name: Checkout Wiki Repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: ${{ env.wiki_target_repo }}
path: ${{ env.wiki_target_repo }}
Expand Down
2 changes: 1 addition & 1 deletion accelerator/.github/workflows/alz-bicep-1-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion accelerator/.github/workflows/alz-bicep-3-subplacement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion accelerator/.github/workflows/alz-bicep-4a-hubspoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion accelerator/.github/workflows/alz-bicep-4b-vwan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion accelerator/.github/workflows/alz-bicep-pr1-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion accelerator/.github/workflows/alz-bicep-pr2-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
6 changes: 3 additions & 3 deletions docs/wiki/PipelinesGitHub.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -59,7 +59,7 @@ jobs:
parameters: infra-as-code/bicep/modules/policy/definitions/parameters/customPolicyDefinitions.parameters.all.json
deploymentName: create_policy_defs-${{ env.runNumber }}
failOnStdErr: false

- name: Deploy Custom Role Definitions
id: create_rbac_roles
uses: azure/arm-deploy@v1
Expand Down Expand Up @@ -176,4 +176,4 @@ jobs:
parameters: infra-as-code/bicep/modules/spokeNetworking/parameters/spokeNetworking.parameters.all.json
deploymentName: create_spoke_network-${{ env.runNumber }}
failOnStdErr: false
```
```

0 comments on commit 85f442a

Please sign in to comment.