Skip to content

Commit cd032e6

Browse files
authored
chore: update CI workflows versions (#79)
* chore: update action versions in CI workflows for consistency and megalinter to v 9.5.0 * add GITHUB_TOKEN MegaLinter config * add false persistance * update files to resolve errors * linting scan updates * update dep and lock * check mkdocs update work * rm team_usage.md * Nav update * remove unnecessary persist-credentials option from checkout step * update after lint * permissions update * update lint * add yamllint config * resolve push issues * rm branch info * crypograph update to 49 or later * json config
1 parent d824e25 commit cd032e6

11 files changed

Lines changed: 166 additions & 173 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ jobs:
2222
python-version: ["3.12"]
2323

2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
26+
with:
27+
persist-credentials: false
2628
- name: Install Poetry
2729
run: pipx install poetry==1.7.1
2830

2931
- name: Set up Python
30-
uses: actions/setup-python@v5
32+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
3133
with:
3234
python-version: ${{ matrix.python-version }}
3335
cache: poetry

.github/workflows/deploy_mkdocs.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ jobs:
1111
deploy:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
15+
with:
16+
persist-credentials: false
1517
- name: Configure Git Credentials
1618
run: |
1719
git config user.name github-actions[bot]
1820
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
19-
- uses: actions/setup-python@v5
21+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
22+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
2023
with:
2124
python-version: 3.x
2225
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
23-
- uses: actions/cache@v4
26+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
2427
with:
2528
key: mkdocs-material-${{ env.cache_id }}
2629
path: .cache

.github/workflows/megalinter.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ jobs:
6666
steps:
6767
# Git Checkout
6868
- name: Checkout Code
69-
uses: actions/checkout@v4
69+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
7070
with:
7171
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
72+
persist-credentials: false
7273

7374
# If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to
7475
# improve performance
@@ -85,8 +86,8 @@ jobs:
8586

8687
# You can override MegaLinter flavor used to have faster performances
8788
# More info at https://megalinter.io/latest/flavors/
88-
# The below commit hash is v8.8.0
89-
uses: oxsecurity/megalinter@e08c2b05e3dbc40af4c23f41172ef1e068a7d651
89+
# The below commit hash is v9.5.0
90+
uses: oxsecurity/megalinter@0e3ce9b9c8c10effb9b269509cc47ca17cae31c7
9091

9192
id: ml
9293

@@ -114,7 +115,7 @@ jobs:
114115

115116
# Upload MegaLinter artifacts
116117
- name: Archive production artifacts
117-
uses: actions/upload-artifact@v4
118+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
118119
if: success() || failure()
119120
with:
120121
name: MegaLinter reports
@@ -158,9 +159,12 @@ jobs:
158159
github.event.pull_request.head.repo.full_name == github.repository
159160
) &&
160161
!contains(github.event.head_commit.message, 'skip fix')
162+
env:
163+
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
164+
PR_URL: ${{ steps.cpr.outputs.pull-request-url }}
161165
run: |
162-
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
163-
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
166+
echo "PR Number - $PR_NUMBER"
167+
echo "PR URL - $PR_URL"
164168
165169
# Push new commit if applicable
166170
# (for now works only on PR from same repository, not from forks)
File renamed without changes.

.mega-linter.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ APPLY_FIXES: all
99

1010
FORMATTERS_DISABLE_ERRORS: false
1111

12+
ACTION_ZIZMOR_UNSECURED_ENV_VARIABLES:
13+
- GITHUB_TOKEN
14+
1215
# If you use ENABLE variable, all other languages/formats/tooling-formats will
1316
# be disabled by default
1417
# ENABLE:

.yamllint.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
# 80 chars should be enough, but don't fail if a line is longer
6+
line-length:
7+
max: 80
8+
level: warning
9+
10+
# don't bother me with this rule
11+
indentation: enable

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -97,37 +97,37 @@ To run the Lambda function outside of a container, we need to execute the `handl
9797

9898
2. Sign in with AWS SSO, and export the correct profile for this service:
9999

100-
```bash
101-
aws sso login
100+
```bash
101+
aws sso login
102102

103-
export AWS_PROFILE=github-copilot-usage-lambda
104-
```
103+
export AWS_PROFILE=github-copilot-usage-lambda
104+
```
105105

106-
This allows you to assume the AWS IAM role for the service, enabling the most secure development experience. This also means you will have limited permissions until you exit out of the profile.
106+
This allows you to assume the AWS IAM role for the service, enabling the most secure development experience. This also means you will have limited permissions until you exit out of the profile.
107107

108-
**Note:** See the Developer Onboarding Guide on the "Using AWS SSO for Local Development" page on Confluence to set up service profile selection on your local machine.
108+
**Note:** See the Developer Onboarding Guide on the "Using AWS SSO for Local Development" page on Confluence to set up service profile selection on your local machine.
109109

110110
3. Export the required environment variables:
111111

112-
```bash
113-
export AWS_DEFAULT_REGION=eu-west-2
114-
export AWS_SECRET_NAME=<aws_secret_name>
115-
export AWS_ACCOUNT_NAME=<sdp-dev/sdp-prod>
116-
export GITHUB_ORG=ONSDigital
117-
export GITHUB_APP_CLIENT_ID=<github_app_client_id>
118-
```
112+
```bash
113+
export AWS_DEFAULT_REGION=eu-west-2
114+
export AWS_SECRET_NAME=<aws_secret_name>
115+
export AWS_ACCOUNT_NAME=<sdp-dev/sdp-prod>
116+
export GITHUB_ORG=ONSDigital
117+
export GITHUB_APP_CLIENT_ID=<github_app_client_id>
118+
```
119119

120120
4. Run the script.
121121

122-
```bash
123-
python3 src/main.py
124-
```
122+
```bash
123+
python3 src/main.py
124+
```
125125

126126
5. To exit the profile:
127127

128-
```bash
129-
unset AWS_PROFILE
130-
```
128+
```bash
129+
unset AWS_PROFILE
130+
```
131131

132132
### Running in a container
133133

concourse/scripts/terraform_infra.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ github_org=$(echo "$secrets" | jq -r .github_org)
2222
export AWS_ACCESS_KEY_ID="$aws_access_key_id"
2323
export AWS_SECRET_ACCESS_KEY="$aws_secret_access_key"
2424

25+
# kingfisher:ignore
2526
git config --global url."https://x-access-token:$github_access_token@github.com/".insteadOf "https://github.com/"
2627

2728
if [ "${env}" != "prod" ]; then

mkdocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ repo_name: GitHub Copilot Usage Lambda
77
nav:
88
- Home: "index.md"
99
- Documentation: "documentation.md"
10-
- Team Usage: "team_usage.md"
10+
- Technical Documentation:
11+
- Overview: "technical_documentation/overview.md"
12+
- Configuration: "technical_documentation/configuration.md"
1113
theme:
1214
name: material
1315
language: en

0 commit comments

Comments
 (0)