Skip to content

Commit c045367

Browse files
committed
apply changes to test PR
1 parent 511f073 commit c045367

10 files changed

+72
-24
lines changed

.github/actions/prepare-test/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ runs:
4949
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version-manual/$artifact_name" >> $GITHUB_OUTPUT
5050
elif [[ ${{ inputs.version }} == *"stable"* ]]; then
5151
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
52-
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT
52+
echo "tools-url=https://github.com/nickfyson-org/codeql-action/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT
5353
elif [[ ${{ inputs.version }} == "latest" ]]; then
5454
echo "tools-url=latest" >> $GITHUB_OUTPUT
5555
elif [[ ${{ inputs.version }} == "default" ]]; then

.github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### Merge / deployment checklist
22

33
- [ ] Confirm this change is backwards compatible with existing workflows.
4-
- [ ] Confirm the [readme](https://github.com/github/codeql-action/blob/main/README.md) has been updated if necessary.
5-
- [ ] Confirm the [changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) has been updated if necessary.
4+
- [ ] Confirm the [readme](https://github.com/nickfyson-org/codeql-action/blob/main/README.md) has been updated if necessary.
5+
- [ ] Confirm the [changelog](https://github.com/nickfyson-org/codeql-action/blob/main/CHANGELOG.md) has been updated if necessary.

.github/update-release-branch.py

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import datetime
3+
import re
34
from github import Github
45
import json
56
import os
@@ -174,6 +175,59 @@ def get_today_string():
174175
today = datetime.datetime.today()
175176
return '{:%d %b %Y}'.format(today)
176177

178+
def process_changelog_for_backports(source_branch_major_version, target_branch_major_version):
179+
180+
# changelog entries can use the following format to indicate
181+
# that they only apply to newer versions
182+
some_versions_only_regex = re.compile(r'\[v(\d+)\+ only\]')
183+
184+
output = ''
185+
186+
with open('CHANGELOG.md', 'r') as f:
187+
188+
# until we find the first section, just duplicate all lines
189+
while True:
190+
line = f.readline()
191+
if not line:
192+
raise Exception('Could not find the first changed section in CHANGELOG') # EOF
193+
194+
if line.startswith('## '):
195+
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
196+
# we have found the first section, so now handle things differently
197+
break
198+
199+
# found_content tracks whether we hit two headings in a row
200+
found_content = False
201+
output += '\n'
202+
while True:
203+
line = f.readline()
204+
if not line:
205+
break # EOF
206+
line = line.rstrip('\n')
207+
208+
# filter out changenote entries that apply only to newer versions
209+
match = some_versions_only_regex.search(line)
210+
if match:
211+
if int(target_branch_major_version) < int(match.group(1)):
212+
continue
213+
214+
if line.startswith('## '):
215+
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
216+
if found_content == False:
217+
# we have found two headings in a row, so we need to add the placeholder message.
218+
output += 'No user facing changes.\n'
219+
found_content = False
220+
output += f'\n{line}\n\n'
221+
else:
222+
if line.strip() != '':
223+
found_content = True
224+
# we use the original line here, rather than the stripped version
225+
# so that we preserve indentation
226+
output += line + '\n'
227+
228+
with open('CHANGELOG.md', 'w') as f:
229+
f.write(output)
230+
177231
def update_changelog(version):
178232
if (os.path.exists('CHANGELOG.md')):
179233
content = ''
@@ -201,7 +255,7 @@ def main():
201255
'--repository-nwo',
202256
type=str,
203257
required=True,
204-
help='The nwo of the repository, for example github/codeql-action.'
258+
help='The nwo of the repository, for example nickfyson-org/codeql-action.'
205259
)
206260
parser.add_argument(
207261
'--source-branch',
@@ -324,13 +378,7 @@ def main():
324378

325379
# Migrate the changelog notes from vLatest version numbers to vOlder version numbers
326380
print(f'Migrating changelog notes from v{source_branch_major_version} to v{target_branch_major_version}')
327-
subprocess.check_output(['sed', '-i', f's/^## {source_branch_major_version}\./## {target_branch_major_version}./g', 'CHANGELOG.md'])
328-
329-
# Remove changelog notes from all versions that do not apply to the vOlder branch
330-
print(f'Removing changelog notes that do not apply to v{target_branch_major_version}')
331-
for v in range(int(source_branch_major_version), int(target_branch_major_version), -1):
332-
print(f'Removing changelog notes that are tagged [v{v}+ only\]')
333-
subprocess.check_output(['sed', '-i', f'/^- \[v{v}+ only\]/d', 'CHANGELOG.md'])
381+
process_changelog_for_backports(source_branch_major_version, target_branch_major_version)
334382

335383
# Amend the commit generated by `npm version` to update the CHANGELOG
336384
run_git('add', 'CHANGELOG.md')

.github/workflows/check-expected-release-files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
bundle_version="$(cat "./src/defaults.json" | jq -r ".bundleVersion")"
2222
set -x
2323
for expected_file in "codeql-bundle.tar.gz" "codeql-bundle-linux64.tar.gz" "codeql-bundle-osx64.tar.gz" "codeql-bundle-win64.tar.gz"; do
24-
curl --location --fail --head --request GET "https://github.com/github/codeql-action/releases/download/$bundle_version/$expected_file" > /dev/null
24+
curl --location --fail --head --request GET "https://github.com/nickfyson-org/codeql-action/releases/download/$bundle_version/$expected_file" > /dev/null
2525
done

.github/workflows/post-release-mergeback.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
jobs:
2222
merge-back:
2323
runs-on: ubuntu-latest
24-
if: github.repository == 'github/codeql-action'
24+
if: github.repository == 'nickfyson-org/codeql-action'
2525
env:
2626
BASE_BRANCH: "${{ github.event.inputs.baseBranch || 'main' }}"
2727
HEAD_BRANCH: "${{ github.head_ref || github.ref }}"

.github/workflows/rebuild.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2222
PR_NUMBER: ${{ github.event.pull_request.number }}
2323
run: |
24-
gh pr edit --repo github/codeql-action "$PR_NUMBER" \
24+
gh pr edit --repo nickfyson-org/codeql-action "$PR_NUMBER" \
2525
--remove-label "Rebuild"
2626
2727
- name: Compile TypeScript
@@ -55,6 +55,6 @@ jobs:
5555
git push origin "HEAD:$BRANCH"
5656
echo "Pushed a commit to rebuild the Action." \
5757
"Please mark the PR as ready for review to trigger PR checks." |
58-
gh pr comment --body-file - --repo github/codeql-action "$PR_NUMBER"
59-
gh pr ready --undo --repo github/codeql-action "$PR_NUMBER"
58+
gh pr comment --body-file - --repo nickfyson-org/codeql-action "$PR_NUMBER"
59+
gh pr ready --undo --repo nickfyson-org/codeql-action "$PR_NUMBER"
6060
fi

.github/workflows/script/update-required-checks.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
if ! gh auth status 2>/dev/null; then
66
gh auth status
7-
echo "Failed: Not authorized. This script requires admin access to github/codeql-action through the gh CLI."
7+
echo "Failed: Not authorized. This script requires admin access to nickfyson-org/codeql-action through the gh CLI."
88
exit 1
99
fi
1010

@@ -23,15 +23,15 @@ fi
2323
echo "Getting checks for $GITHUB_SHA"
2424

2525
# Ignore any checks with "https://", CodeQL, LGTM, and Update checks.
26-
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs | .[].name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or contains("Update") or contains("update") or contains("test-setup-python-scripts") | not)] | unique | sort')"
26+
CHECKS="$(gh api repos/nickfyson-org/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs | .[].name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or contains("Update") or contains("update") or contains("test-setup-python-scripts") | not)] | unique | sort')"
2727

2828
echo "$CHECKS" | jq
2929

3030
echo "{\"contexts\": ${CHECKS}}" > checks.json
3131

3232
for BRANCH in main releases/v2; do
3333
echo "Updating $BRANCH"
34-
gh api --silent -X "PATCH" "repos/github/codeql-action/branches/$BRANCH/protection/required_status_checks" --input checks.json
34+
gh api --silent -X "PATCH" "repos/nickfyson-org/codeql-action/branches/$BRANCH/protection/required_status_checks" --input checks.json
3535
done
3636

3737
rm checks.json

.github/workflows/update-dependencies.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
name: Update dependencies
99
timeout-minutes: 45
1010
runs-on: macos-latest
11-
if: contains(github.event.pull_request.labels.*.name, 'Update dependencies') && (github.event.pull_request.head.repo.full_name == 'github/codeql-action')
11+
if: contains(github.event.pull_request.labels.*.name, 'Update dependencies') && (github.event.pull_request.head.repo.full_name == 'nickfyson-org/codeql-action')
1212
steps:
1313
- name: Checkout repository
1414
uses: actions/checkout@v4
@@ -37,6 +37,6 @@ jobs:
3737
git push origin "HEAD:$BRANCH"
3838
echo "Pushed a commit to update the checked-in dependencies." \
3939
"Please mark the PR as ready for review to trigger PR checks." |
40-
gh pr comment --body-file - --repo github/codeql-action "${{ github.event.pull_request.number }}"
41-
gh pr ready --undo --repo github/codeql-action "${{ github.event.pull_request.number }}"
40+
gh pr comment --body-file - --repo nickfyson-org/codeql-action "${{ github.event.pull_request.number }}"
41+
gh pr ready --undo --repo nickfyson-org/codeql-action "${{ github.event.pull_request.number }}"
4242
fi

.github/workflows/update-release-branch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
prepare:
1717
runs-on: ubuntu-latest
18-
if: github.repository == 'github/codeql-action'
18+
if: github.repository == 'nickfyson-org/codeql-action'
1919
outputs:
2020
version: ${{ steps.versions.outputs.version }}
2121
major_version: ${{ steps.versions.outputs.major_version }}

.github/workflows/update-supported-enterprise-server-versions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Update Supported Enterprise Server Versions
1111
timeout-minutes: 45
1212
runs-on: ubuntu-latest
13-
if: ${{ github.repository == 'github/codeql-action' }}
13+
if: ${{ github.repository == 'nickfyson-org/codeql-action' }}
1414

1515
steps:
1616
- name: Setup Python

0 commit comments

Comments
 (0)